summaryrefslogtreecommitdiffstats
path: root/usr.bin
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/su/su.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/usr.bin/su/su.c b/usr.bin/su/su.c
index f6d3ff3..dae818f 100644
--- a/usr.bin/su/su.c
+++ b/usr.bin/su/su.c
@@ -520,10 +520,8 @@ chshell(char *sh)
r = 0;
setusershell();
- do {
- cp = getusershell();
- r = strcmp(cp, sh);
- } while (!r && cp != NULL);
+ while ((cp = getusershell()) != NULL && !r)
+ r = (strcmp(cp, sh) == 0);
endusershell();
return r;
}
OpenPOWER on IntegriCloud