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

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

 



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));
                     }
 
                     newtPopWindow();
-- 
1.6.2.5

_______________________________________________
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