xstrdup tftp cleanup from Jeff Garzik
authorEric Andersen <andersen@codepoet.org>
Fri, 23 Mar 2001 17:10:19 +0000 (17:10 -0000)
committerEric Andersen <andersen@codepoet.org>
Fri, 23 Mar 2001 17:10:19 +0000 (17:10 -0000)
networking/tftp.c
tftp.c

index e4e01b9..309df36 100644 (file)
@@ -387,12 +387,11 @@ int tftp_main(int argc, char **argv)
 
                serverfile = cp + 1;
 
-               if ((s = strdup(serverstr))) {
-                       s[cp - serverstr] = '\0';
+               s = xstrdup(serverstr);
+               s[cp - serverstr] = '\0';
 
-                       if ((host = gethostbyname(s))) {
-                               bad = 0;
-                       }
+               if ((host = gethostbyname(s))) {
+                       bad = 0;
                }
 
                free(s);
diff --git a/tftp.c b/tftp.c
index e4e01b9..309df36 100644 (file)
--- a/tftp.c
+++ b/tftp.c
@@ -387,12 +387,11 @@ int tftp_main(int argc, char **argv)
 
                serverfile = cp + 1;
 
-               if ((s = strdup(serverstr))) {
-                       s[cp - serverstr] = '\0';
+               s = xstrdup(serverstr);
+               s[cp - serverstr] = '\0';
 
-                       if ((host = gethostbyname(s))) {
-                               bad = 0;
-                       }
+               if ((host = gethostbyname(s))) {
+                       bad = 0;
                }
 
                free(s);