summaryrefslogtreecommitdiffstats
path: root/usr.bin/su
diff options
context:
space:
mode:
authorroberto <roberto@FreeBSD.org>1998-09-21 07:47:53 +0000
committerroberto <roberto@FreeBSD.org>1998-09-21 07:47:53 +0000
commitb65a162445da436af501c17fb4d50164c1c63c5f (patch)
tree599975de70bc321cc5369b510070807f1d2fa9fc /usr.bin/su
parentbece27a0578fe27b47097b5fde79da6b4a0bc752 (diff)
downloadFreeBSD-src-b65a162445da436af501c17fb4d50164c1c63c5f.zip
FreeBSD-src-b65a162445da436af501c17fb4d50164c1c63c5f.tar.gz
Fix bad option processing.
PR: bin/7986 Submitted by: Dan Nelson <dnelson@emsphone.com>
Diffstat (limited to 'usr.bin/su')
-rw-r--r--usr.bin/su/su.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/usr.bin/su/su.c b/usr.bin/su/su.c
index ee4941e..f2196a0 100644
--- a/usr.bin/su/su.c
+++ b/usr.bin/su/su.c
@@ -42,7 +42,7 @@ static const char copyright[] =
static char sccsid[] = "@(#)su.c 8.3 (Berkeley) 4/2/94";
#endif
static const char rcsid[] =
- "$Id: su.c,v 1.26 1998/05/25 03:34:52 steve Exp $";
+ "$Id: su.c,v 1.27 1998/05/26 06:39:08 danny Exp $";
#endif /* not lint */
#include <sys/param.h>
@@ -134,8 +134,7 @@ main(argc, argv)
#endif /* WHEELSU */
asme = asthem = fastlogin = 0;
user = "root";
- while(optind < argc)
- if((ch = getopt(argc, argv, ARGSTR)) != -1)
+ while((ch = getopt(argc, argv, ARGSTR)) != -1)
switch((char)ch) {
#ifdef KERBEROS
case 'K':
@@ -163,11 +162,9 @@ main(argc, argv)
default:
usage();
}
- else
- {
+
+ if (optind < argc)
user = argv[optind++];
- break;
- }
if (strlen(user) > MAXLOGNAME - 1) {
(void)fprintf(stderr, "su: username too long.\n");
OpenPOWER on IntegriCloud