Re: [PATCH] Log identifyNIC() errors correctly (#473747)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Tue, 4 Aug 2009, Peter Jones wrote:

On 08/04/2009 05:31 PM, David Cantrell wrote:
Remove perror() statements from identifyNIC() as it causes messages to
pop up on the console and disappear quickly since we are using newt.
Use strerror(errno) in loader2/net.c since failures from identifyNIC()
will set errno for us.
---
 isys/ethtool.c |    5 +++--
 loader2/net.c  |    5 +++--
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/isys/ethtool.c b/isys/ethtool.c
index 8bd5776..344a7d2 100644
--- a/isys/ethtool.c
+++ b/isys/ethtool.c
@@ -92,8 +92,8 @@ int identifyNIC(char *iface, int seconds) {
     struct ethtool_value edata;
     struct ifreq ifr;

+    errno = 0;
     if ((sock = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
-        perror("Unable to create socket");
         return -1;
     }

@@ -105,8 +105,9 @@ int identifyNIC(char *iface, int seconds) {
     edata.data = seconds;
     ifr.ifr_data = (caddr_t) &edata;

+    errno = 0;
     if (ioctl(sock, SIOCETHTOOL, &ifr) < 0) {
-        perror("Unable to identify NIC");
+        return -1;
     }

     return 0;
diff --git a/loader2/net.c b/loader2/net.c
index 17e6e34..c1781c1 100644
--- a/loader2/net.c
+++ b/loader2/net.c
@@ -2385,8 +2385,9 @@ int chooseNetworkInterface(struct loaderData_s * loaderData) {
                               devices[deviceNum], secs);

                     if (identifyNIC(devices[deviceNum], secs)) {
-                        logMessage(ERROR,
-                                   "error during physical NIC identification");
+                        logMessage(ERROR, "error during physical NIC "
+                                          "identification: %s",
+                                   strerror(errno));

Why not %m here instead of the strerror() crud?

No reason, I just didn't think about it.

                     }

                     newtPopWindow();

Other than that one question, looks fine.

The bug died en route to the blocker list, so I won't be applying this to
rhel5-branch.

I guess I'll make a variant of this patch for rawhide.

- -- David Cantrell <dcantrell@xxxxxxxxxx>
Red Hat / Honolulu, HI

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAkp4rCAACgkQ5hsjjIy1VknXdgCbB0EOS146bj5G2EYN0QyeDnrb
hBEAoOlXqoR8xcWla/d4OQ1LmRFPkJ90
=qv3Z
-----END PGP SIGNATURE-----

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux