[PATCH] Log identifyNIC() failures 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 +++--
 loader/net.c   |    3 ++-
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/isys/ethtool.c b/isys/ethtool.c
index 871f1d4..597c238 100644
--- a/isys/ethtool.c
+++ b/isys/ethtool.c
@@ -98,8 +98,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;
     }
 
@@ -111,8 +111,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/loader/net.c b/loader/net.c
index 486c160..b203c0e 100644
--- a/loader/net.c
+++ b/loader/net.c
@@ -1905,7 +1905,8 @@ int chooseNetworkInterface(struct loaderData_s * loaderData) {
 
                     if (identifyNIC(devices[deviceNum], secs)) {
                         logMessage(ERROR,
-                                   "error during physical NIC identification");
+                                   "error during physical NIC "
+                                   "identification: %m");
                     }
 
                     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