summaryrefslogtreecommitdiff
path: root/ifconfig.c
diff options
context:
space:
mode:
authorAndi Kleen <andi@firstfloor.org>2000-10-26 03:19:06 +0000
committerAndi Kleen <andi@firstfloor.org>2000-10-26 03:19:06 +0000
commita1cccab540399e8e410049d6607a73ec33c31f2b (patch)
treeb2c96e4d2b3f8178b737f814e581431485baad97 /ifconfig.c
parent7e8833ee19b78e75ebcc72bd4d8ed3a885171959 (diff)
downloadnet-tools-a1cccab540399e8e410049d6607a73ec33c31f2b.tar.gz
net-tools-a1cccab540399e8e410049d6607a73ec33c31f2b.tar.bz2
net-tools-a1cccab540399e8e410049d6607a73ec33c31f2b.zip
Always complain when SIOCGIFMAP fails.
Make sure the argument counter is incremented in all error paths.
Diffstat (limited to 'ifconfig.c')
-rw-r--r--ifconfig.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/ifconfig.c b/ifconfig.c
index 3aca327..fc83bbd 100644
--- a/ifconfig.c
+++ b/ifconfig.c
@@ -3,7 +3,7 @@
* that either displays or sets the characteristics of
* one or more of the system's networking interfaces.
*
- * Version: $Id: ifconfig.c,v 1.42 2000/10/08 00:48:35 ecki Exp $
+ * Version: $Id: ifconfig.c,v 1.43 2000/10/26 03:19:06 ak Exp $
*
* Author: Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org>
* and others. Copyright 1993 MicroWalt Corporation
@@ -362,12 +362,13 @@ int main(int argc, char **argv)
goterr = 1;
} else {
if (ioctl(skfd, SIOCGIFMAP, &ifr) < 0) {
+ perror("port: SIOCGIFMAP");
goterr = 1;
continue;
}
ifr.ifr_map.port = newport;
if (ioctl(skfd, SIOCSIFMAP, &ifr) < 0) {
- perror("SIOCSIFMAP");
+ perror("port: SIOCSIFMAP");
goterr = 1;
}
}
@@ -568,12 +569,14 @@ int main(int argc, char **argv)
if (*++spp == NULL)
usage();
if (ioctl(skfd, SIOCGIFMAP, &ifr) < 0) {
+ fprintf(stderr, "mem_start: SIOCGIFMAP: %s\n", strerror(errno));
+ spp++;
goterr = 1;
continue;
}
ifr.ifr_map.mem_start = strtoul(*spp, NULL, 0);
if (ioctl(skfd, SIOCSIFMAP, &ifr) < 0) {
- fprintf(stderr, "SIOCSIFMAP: %s\n", strerror(errno));
+ fprintf(stderr, "mem_start: SIOCSIFMAP: %s\n", strerror(errno));
goterr = 1;
}
spp++;
@@ -583,12 +586,14 @@ int main(int argc, char **argv)
if (*++spp == NULL)
usage();
if (ioctl(skfd, SIOCGIFMAP, &ifr) < 0) {
+ fprintf(stderr, "io_addr: SIOCGIFMAP: %s\n", strerror(errno));
+ spp++;
goterr = 1;
continue;
}
ifr.ifr_map.base_addr = strtol(*spp, NULL, 0);
if (ioctl(skfd, SIOCSIFMAP, &ifr) < 0) {
- fprintf(stderr, "SIOCSIFMAP: %s\n", strerror(errno));
+ fprintf(stderr, "io_addr: SIOCSIFMAP: %s\n", strerror(errno));
goterr = 1;
}
spp++;
@@ -598,12 +603,14 @@ int main(int argc, char **argv)
if (*++spp == NULL)
usage();
if (ioctl(skfd, SIOCGIFMAP, &ifr) < 0) {
+ fprintf(stderr, "irq: SIOCGIFMAP: %s\n", strerror(errno));
goterr = 1;
+ spp++;
continue;
}
ifr.ifr_map.irq = atoi(*spp);
if (ioctl(skfd, SIOCSIFMAP, &ifr) < 0) {
- fprintf(stderr, "SIOCSIFMAP: %s\n", strerror(errno));
+ fprintf(stderr, "irq: SIOCSIFMAP: %s\n", strerror(errno));
goterr = 1;
}
spp++;