Make sure we have a show_usage function prototype
[oweals/busybox.git] / networking / udhcp / dhcpc.c
index 295486c98fee27c51c6abb6d53a667d80c3d6f36..c55ebbb09a65c32ff5e9fdf431bbddb3921814d2 100644 (file)
@@ -77,7 +77,7 @@ struct client_config_t client_config = {
 };
 
 #ifndef BB_VER
-static void show_usage(void)
+static void __attribute__ ((noreturn)) show_usage(void)
 {
        printf(
 "Usage: udhcpc [OPTIONS]\n\n"
@@ -99,6 +99,8 @@ static void show_usage(void)
        );
        exit(0);
 }
+#else
+extern void show_usage(void) __attribute__ ((noreturn));
 #endif
 
 
@@ -246,7 +248,7 @@ int main(int argc, char *argv[])
                switch (c) {
                case 'c':
                        len = strlen(optarg) > 255 ? 255 : strlen(optarg);
-                       if (client_config.clientid) free(client_config.clientid);
+                       free(client_config.clientid);
                        client_config.clientid = xmalloc(len + 2);
                        client_config.clientid[OPT_CODE] = DHCP_CLIENT_ID;
                        client_config.clientid[OPT_LEN] = len;
@@ -262,7 +264,7 @@ int main(int argc, char *argv[])
                case 'h':
                case 'H':
                        len = strlen(optarg) > 255 ? 255 : strlen(optarg);
-                       if (client_config.hostname) free(client_config.hostname);
+                       free(client_config.hostname);
                        client_config.hostname = xmalloc(len + 2);
                        client_config.hostname[OPT_CODE] = DHCP_HOST_NAME;
                        client_config.hostname[OPT_LEN] = len;