Back out (with prejudice) the last WARNS=2 fix. I cannot understand

its failure mode, and will revisit it later.
This commit is contained in:
Mark Murray 2001-09-07 16:20:38 +00:00
parent 92933027f4
commit 73bd08dda4
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=83209
2 changed files with 9 additions and 11 deletions

View File

@ -6,7 +6,9 @@ PROG= su
DPADD+= ${LIBUTIL} ${LIBPAM}
LDADD+= -lutil ${MINUSLPAM}
WARNS?= 2
# Cannot be enabled because of a truly nasty warning/problem
# concering execv(2)'s second argument.
#WARNS?= 2
BINMODE=4555
INSTALLFLAGS=-fschg

View File

@ -114,17 +114,13 @@ main(int argc, char *argv[])
struct pam_conv conv = {misc_conv, NULL};
enum tristate iscsh;
login_cap_t *lc;
union {
const char **a;
char * const b[1];
} np;
uid_t ruid;
gid_t gid;
int asme, ch, asthem, fastlogin, prio, i, setwhat, retcode,
statusp, child_pid, child_pgrp, ret_pid;
char *username, *cleanenv, *class, shellbuf[MAXPATHLEN],
myhost[MAXHOSTNAMELEN + 1];
const char *p, *user, *shell, *mytty, **nargv;
const char *p, *user, *shell, *mytty, **nargv, **np;
shell = class = cleanenv = NULL;
asme = asthem = fastlogin = statusp = 0;
@ -169,7 +165,7 @@ main(int argc, char *argv[])
nargv[argc + 3] = NULL;
for (i = argc; i >= optind; i--)
nargv[i + 3] = argv[i];
np.a = &nargv[i + 3];
np = &nargv[i + 3];
argv += optind;
@ -382,18 +378,18 @@ main(int argc, char *argv[])
if (iscsh == YES) {
if (fastlogin)
*np.a-- = "-f";
*np-- = "-f";
if (asme)
*np.a-- = "-m";
*np-- = "-m";
}
/* csh strips the first character... */
*np.a = asthem ? "-su" : iscsh == YES ? "_su" : "su";
*np = asthem ? "-su" : iscsh == YES ? "_su" : "su";
if (ruid != 0)
syslog(LOG_NOTICE, "%s to %s%s", username, user,
ontty());
execv(shell, np.b);
execv(shell, np);
err(1, "%s", shell);
}
}