summaryrefslogtreecommitdiff
path: root/usr.bin/su
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2002-12-08 16:50:08 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2002-12-08 16:50:08 +0000
commitc5a38b6fdf1c2335f7f5558976e478f12d297990 (patch)
treea24f21bafd589dbe349a9eb8ce3651b05695577c /usr.bin/su
parent575d3fc4197705961dd3a1a91780df758087ebec (diff)
GNU semantics say that if optstring begins with '-' then
each non-option shall be treated as arguments to option '\1'. BSD getopt match '-' in optstring with a '-' on the command line. This is used to support deprecated options like "su -" that would otherwise prevent the use of getopt(). Resolving this simply requires that the leading '-' be moved somewhere else (I moved it to the end of optstring) since position within optstring is not meaningful.
Diffstat (limited to 'usr.bin/su')
-rw-r--r--usr.bin/su/su.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/usr.bin/su/su.c b/usr.bin/su/su.c
index 9559ca769a9..ea0b1b6dd1a 100644
--- a/usr.bin/su/su.c
+++ b/usr.bin/su/su.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: su.c,v 1.49 2002/12/07 22:54:13 millert Exp $ */
+/* $OpenBSD: su.c,v 1.50 2002/12/08 16:50:07 millert Exp $ */
/*
* Copyright (c) 1988 The Regents of the University of California.
@@ -43,7 +43,7 @@ static const char copyright[] =
#if 0
static const char sccsid[] = "from: @(#)su.c 5.26 (Berkeley) 7/6/91";
#else
-static const char rcsid[] = "$OpenBSD: su.c,v 1.49 2002/12/07 22:54:13 millert Exp $";
+static const char rcsid[] = "$OpenBSD: su.c,v 1.50 2002/12/08 16:50:07 millert Exp $";
#endif
#endif /* not lint */
@@ -89,7 +89,7 @@ main(int argc, char **argv)
login_cap_t *lc;
uid_t ruid;
- while ((ch = getopt(argc, argv, "-a:c:fKLlm")) != -1)
+ while ((ch = getopt(argc, argv, "a:c:fKLlm-")) != -1)
switch (ch) {
case 'a':
if (style)