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 e4e01b9a2f780cd90dfb3f8746408891044a0e68..309df36b301d1a7b88a82cd278b1e0897060d1d1 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 e4e01b9a2f780cd90dfb3f8746408891044a0e68..309df36b301d1a7b88a82cd278b1e0897060d1d1 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);