summaryrefslogtreecommitdiff
path: root/sbin/ifconfig/ifconfig.c
diff options
context:
space:
mode:
authorHenning Brauer <henning@cvs.openbsd.org>2006-08-29 17:22:01 +0000
committerHenning Brauer <henning@cvs.openbsd.org>2006-08-29 17:22:01 +0000
commit9a4970c8ef77bcfd31ae3e0672adf4ce023bab6c (patch)
treeee4adfa25f2b462badf3836e0c7138a04299c4f0 /sbin/ifconfig/ifconfig.c
parent259f992f28716b6799e779ff01d78085092928cb (diff)
allow a numeric argument to "carpdemote" to in-/decrease the demotion
counter by more than one. manpage help by jmc, ok mcbride mpf deraadt
Diffstat (limited to 'sbin/ifconfig/ifconfig.c')
-rw-r--r--sbin/ifconfig/ifconfig.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/sbin/ifconfig/ifconfig.c b/sbin/ifconfig/ifconfig.c
index d44ffa3ebfb..8ef266fdb72 100644
--- a/sbin/ifconfig/ifconfig.c
+++ b/sbin/ifconfig/ifconfig.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ifconfig.c,v 1.173 2006/08/18 08:21:08 deraadt Exp $ */
+/* $OpenBSD: ifconfig.c,v 1.174 2006/08/29 17:22:00 henning Exp $ */
/* $NetBSD: ifconfig.c,v 1.40 1997/10/01 02:19:43 enami Exp $ */
/*
@@ -761,6 +761,7 @@ printgroupattribs(char *groupname)
void
setgroupattribs(char *groupname, int argc, char *argv[])
{
+ const char *errstr;
char *p = argv[0];
int neg = 1;
@@ -769,8 +770,15 @@ setgroupattribs(char *groupname, int argc, char *argv[])
getsock(AF_INET);
bzero(&ifgr, sizeof(ifgr));
strlcpy(ifgr.ifgr_name, groupname, sizeof(ifgr.ifgr_name));
+
+ if (argc > 1) {
+ neg = strtonum(argv[1], 0, 128, &errstr);
+ if (errstr)
+ errx(1, "invalid carp demotion: %s", errstr);
+ }
+
if (p[0] == '-') {
- neg = -1;
+ neg = neg * -1;
p++;
}
if (!strcmp(p, "carpdemote"))