=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/su/su.c,v retrieving revision 1.80 retrieving revision 1.81 diff -u -r1.80 -r1.81 --- src/usr.bin/su/su.c 2020/07/08 10:35:06 1.80 +++ src/usr.bin/su/su.c 2020/07/08 15:36:35 1.81 @@ -1,4 +1,4 @@ -/* $OpenBSD: su.c,v 1.80 2020/07/08 10:35:06 jca Exp $ */ +/* $OpenBSD: su.c,v 1.81 2020/07/08 15:36:35 jca Exp $ */ /* * Copyright (c) 1988 The Regents of the University of California. @@ -311,22 +311,23 @@ err(1, "pledge"); np = *argv ? argv : argv - 1; + if (iscsh == YES) { if (fastlogin) *np-- = "-f"; if (asme) *np-- = "-m"; - } - if (asthem) { - if (iscsh == YES || !fastlogin) { + if (asthem) avshellbuf[0] = '-'; - strlcpy(avshellbuf+1, avshell, sizeof(avshellbuf) - 1); - avshell = avshellbuf; + else { + /* csh strips the first character... */ + avshellbuf[0] = '_'; } - } else if (iscsh == YES) { - /* csh strips the first character... */ - avshellbuf[0] = '_'; + strlcpy(avshellbuf+1, avshell, sizeof(avshellbuf) - 1); + avshell = avshellbuf; + } else if (asthem && !fastlogin) { + avshellbuf[0] = '-'; strlcpy(avshellbuf+1, avshell, sizeof(avshellbuf) - 1); avshell = avshellbuf; }