]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
sntp: avoid use of uninitialized variable
authorLuuk Paulussen <luuk.paulussen@alliedtelesis.co.nz>
Mon, 16 May 2011 18:27:11 +0000 (18:27 +0000)
committerWolfgang Denk <wd@denx.de>
Wed, 1 Jun 2011 20:35:09 +0000 (22:35 +0200)
When we use the ntpserverip environment variable argv[1] may not be set.
Printing the error message using the NetNtpServerIP variable ensures the
correct output in both cases.

Signed-off-by: Luuk Paulussen <luuk.paulussen@alliedtelesis.co.nz>
Acked-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
Cc: Ben Warren <biggerbadderben@gmail.com>
Acked-by: Detlev Zundel <dzu@denx.de>
common/cmd_net.c

index b2c9355a21abe2db2622b03be5a0b9a8b87370fd..75ba1c3cdcece26a8cbf918255918a49cf71f689 100644 (file)
@@ -341,7 +341,8 @@ int do_sntp (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
        else NetTimeOffset = simple_strtol (toff, NULL, 10);
 
        if (NetLoop(SNTP) < 0) {
-               printf("SNTP failed: host %s not responding\n", argv[1]);
+               printf("SNTP failed: host %pI4 not responding\n",
+                       &NetNtpServerIP);
                return 1;
        }