arping: fix iface name in error messages
authorAlexander Korolkov <alexander.korolkov@gmail.com>
Thu, 12 Mar 2015 12:05:33 +0000 (13:05 +0100)
committerDenys Vlasenko <vda.linux@googlemail.com>
Thu, 12 Mar 2015 12:05:33 +0000 (13:05 +0100)
arping: interface eth0 not found: No such device
                  ^^^^

This is because error template is formed before parsing command line arguments,
so it always uses default interface name "eth0".

Signed-off-by: Alexander Korolkov <alexander.korolkov@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
networking/arping.c

index a4421edcba01570a952bdfdd54590276266c2c49..dbfd75ef52da712393cca1c81c13d8cb31a84560 100644 (file)
@@ -284,7 +284,6 @@ int arping_main(int argc UNUSED_PARAM, char **argv)
        // Need to remove SUID_NEVER from applets.h for this to work
        //xsetuid(getuid());
 
-       err_str = xasprintf("interface %s %%s", device);
        {
                unsigned opt;
                char *str_timeout;
@@ -302,7 +301,7 @@ int arping_main(int argc UNUSED_PARAM, char **argv)
        }
 
        target = argv[optind];
-
+       err_str = xasprintf("interface %s %%s", device);
        xfunc_error_retval = 2;
 
        {