# HG changeset patch # User Richard Lowe # Date 1301437640 0 # Node ID 90920e3f9201507acc3be0306ac937c57ad30885 # Parent 1aaef96dabf669302e84d48f9522cc39768cd379 850 system(3C) and similar could just use /bin/sh Reviewed by: Gordon Ross Reviewed by: John Sonnenschein Approved by: Garrett D'Amore diff -r 1aaef96dabf6 -r 90920e3f9201 usr/src/cmd/cron/at.c --- a/usr/src/cmd/cron/at.c Wed Mar 30 23:00:17 2011 -0400 +++ b/usr/src/cmd/cron/at.c Tue Mar 29 22:27:20 2011 +0000 @@ -48,6 +48,7 @@ #include #include #include +#include #include "cron.h" @@ -606,11 +607,7 @@ ulimit_flag = 1; } else { /* SHELL is NULL or unset, therefore use default */ -#ifdef XPG4 - Shell = shell = "/usr/xpg4/bin/sh"; -#else - Shell = shell = "/bin/sh"; -#endif /* XPG4 */ + Shell = shell = _PATH_BSHELL; ulimit_flag = 1; } diff -r 1aaef96dabf6 -r 90920e3f9201 usr/src/cmd/ed/ed.c --- a/usr/src/cmd/ed/ed.c Wed Mar 30 23:00:17 2011 -0400 +++ b/usr/src/cmd/ed/ed.c Tue Mar 29 22:27:20 2011 +0000 @@ -39,6 +39,7 @@ #include #include #include +#include static const char *msgtab[] = { @@ -263,8 +264,6 @@ static long savtime; static char *name = "SHELL"; static char *rshell = "/usr/lib/rsh"; -static char *shpath; /* pointer to correct shell for execution */ - /* of execlp() */ static char *val; static char *home; static int nodelim; @@ -1581,13 +1580,7 @@ signal(SIGHUP, oldhup); signal(SIGQUIT, oldquit); close(tfile); - if (__xpg4 == 0) { /* not XPG4 */ - shpath = "/usr/bin/sh"; - } else { - /* XPG4 */ - shpath = "/usr/xpg4/bin/sh"; - } - execlp((const char *)shpath, "sh", "-c", curcmd, (char *)0); + execlp(_PATH_BSHELL, "sh", "-c", curcmd, (char *)0); exit(0100); } savint = signal(SIGINT, SIG_IGN); @@ -2697,13 +2690,7 @@ close(w_or_r(0, 1)); dup(w_or_r(pf[0], pf[1])); close(w_or_r(pf[0], pf[1])); - if (__xpg4 == 0) { /* not XPG4 */ - shpath = "/usr/bin/sh"; - } else { - /* XPG4 */ - shpath = "/usr/xpg4/bin/sh"; - } - execlp((const char *)shpath, "sh", "-c", string, (char *)0); + execlp(_PATH_BSHELL, "sh", "-c", string, (char *)0); exit(1); } if (i == (pid_t)-1) diff -r 1aaef96dabf6 -r 90920e3f9201 usr/src/lib/libc/port/gen/execvp.c --- a/usr/src/lib/libc/port/gen/execvp.c Wed Mar 30 23:00:17 2011 -0400 +++ b/usr/src/lib/libc/port/gen/execvp.c Tue Mar 29 22:27:20 2011 +0000 @@ -27,8 +27,6 @@ /* Copyright (c) 1988 AT&T */ /* All Rights Reserved */ -#pragma ident "%Z%%M% %I% %E% SMI" - /* * execlp(name, arg,...,0) (like execl, but does path search) * execvp(name, argv) (like execv, but does path search) @@ -46,6 +44,7 @@ #include #include #include +#include static const char *execat(const char *, const char *, char *); @@ -114,10 +113,6 @@ const char *cp; unsigned etxtbsy = 1; int eacces = 0; - char *shpath; - static const char *sun_path = "/bin/sh"; - static const char *xpg4_path = "/usr/xpg4/bin/sh"; - static const char *shell = "sh"; if (*name == '\0') { errno = ENOENT; @@ -137,8 +132,8 @@ if (__xpg4 == 0) { /* not XPG4 */ pathstr = "/usr/sbin:/usr/ccs/bin:/usr/bin"; } else { /* XPG4 (CSPATH + /usr/sbin) */ - pathstr = "/usr/xpg4/bin:/usr/ccs/bin:/usr/bin:" - "/opt/SUNWspro/bin:/usr/sbin"; + pathstr = "/usr/xpg4/bin:/usr/ccs/bin:/usr/bin:" + "/opt/SUNWspro/bin:/usr/sbin"; } } else { if (__xpg4 == 0) { /* not XPG4 */ @@ -172,12 +167,7 @@ (void) execv(fname, argv); switch (errno) { case ENOEXEC: - if (__xpg4 == 0) { /* not XPG4 */ - shpath = (char *)sun_path; - } else { /* XPG4 */ - shpath = (char *)xpg4_path; - } - newargs[0] = (char *)shell; + newargs[0] = "sh"; newargs[1] = fname; for (i = 1; (newargs[i + 1] = argv[i]) != NULL; ++i) { if (i >= 254) { @@ -185,7 +175,7 @@ return (-1); } } - (void) execv((const char *)shpath, newargs); + (void) execv(_PATH_BSHELL, newargs); return (-1); case ETXTBSY: if (++etxtbsy > 5) diff -r 1aaef96dabf6 -r 90920e3f9201 usr/src/lib/libc/port/stdio/popen.c --- a/usr/src/lib/libc/port/stdio/popen.c Wed Mar 30 23:00:17 2011 -0400 +++ b/usr/src/lib/libc/port/stdio/popen.c Tue Mar 29 22:27:20 2011 +0000 @@ -45,6 +45,7 @@ #include #include #include +#include #include "stdiom.h" #include "mse.h" #include "libc.h" @@ -95,7 +96,7 @@ int myside; int yourside; int fd; - const char *shpath; + const char *shpath = _PATH_BSHELL; FILE *iop; int stdio; node_t *curr; @@ -104,8 +105,6 @@ posix_spawnattr_t attr; posix_spawn_file_actions_t fact; int error; - static const char *sun_path = "/bin/sh"; - static const char *xpg4_path = "/usr/xpg4/bin/sh"; static const char *shell = "sh"; static const char *sh_flg = "-c"; @@ -131,7 +130,6 @@ return (NULL); } - shpath = __xpg4? xpg4_path : sun_path; if (access(shpath, X_OK)) /* XPG4 Requirement: */ shpath = ""; /* force child to fail immediately */ diff -r 1aaef96dabf6 -r 90920e3f9201 usr/src/lib/libc/port/stdio/system.c --- a/usr/src/lib/libc/port/stdio/system.c Wed Mar 30 23:00:17 2011 -0400 +++ b/usr/src/lib/libc/port/stdio/system.c Tue Mar 29 22:27:20 2011 +0000 @@ -42,6 +42,7 @@ #include #include #include +#include #include "libc.h" extern const char **_environ; @@ -124,15 +125,11 @@ int error; sigset_t mask; struct stat64 buf; - const char *shpath; + const char *shpath = _PATH_BSHELL; char *argv[4]; posix_spawnattr_t attr; - static const char *sun_path = "/bin/sh"; - static const char *xpg4_path = "/usr/xpg4/bin/sh"; static const char *shell = "sh"; - shpath = __xpg4? xpg4_path : sun_path; - if (cmd == NULL) { if (stat64(shpath, &buf) != 0) { return (0); diff -r 1aaef96dabf6 -r 90920e3f9201 usr/src/lib/libc/port/threads/spawn.c --- a/usr/src/lib/libc/port/threads/spawn.c Wed Mar 30 23:00:17 2011 -0400 +++ b/usr/src/lib/libc/port/threads/spawn.c Tue Mar 29 22:27:20 2011 +0000 @@ -32,6 +32,7 @@ #include #include #include +#include #define ALL_POSIX_SPAWN_FLAGS \ (POSIX_SPAWN_RESETIDS | \ @@ -382,9 +383,6 @@ char **newargs; int argc; int i; - static const char *sun_path = "/bin/sh"; - static const char *xpg4_path = "/usr/xpg4/bin/sh"; - static const char *shell = "sh"; if (attrp != NULL && sap == NULL) return (EINVAL); @@ -483,13 +481,12 @@ (void) set_error(&error, 0); (void) execve(path, argv, envp); if (set_error(&error, errno) == ENOEXEC) { - newargs[0] = (char *)shell; + newargs[0] = "sh"; newargs[1] = path; for (i = 1; i <= argc; i++) newargs[i + 1] = argv[i]; (void) set_error(&error, 0); - (void) execve(xpg4? xpg4_path : sun_path, - newargs, envp); + (void) execve(_PATH_BSHELL, newargs, envp); if (sap != NULL && (sap->sa_psflags & POSIX_SPAWN_NOEXECERR_NP)) _exit(127); diff -r 1aaef96dabf6 -r 90920e3f9201 usr/src/man/man1/at.1 --- a/usr/src/man/man1/at.1 Wed Mar 30 23:00:17 2011 -0400 +++ b/usr/src/man/man1/at.1 Tue Mar 29 22:27:20 2011 +0000 @@ -148,12 +148,7 @@ \fBSHELL\fR environment variable by default determines which shell to use. .sp .LP -For \fB/usr/xpg4/bin/at\fR and \fB/usr/xpg4/bin/batch\fR, if \fBSHELL\fR is -unset or \fBNULL\fR, \fB/usr/xpg4/bin/sh\fR is used. -.sp -.LP -For \fBusr/bin/at\fR and \fB/usr/bin/batch\fR, if \fBSHELL\fR is unset or -\fBNULL\fR, \fB/bin/sh\fR is used. +If \fBSHELL\fR is unset or \fBNULL\fR, \fB/usr/bin/sh\fR is used. .sp .LP The following options are supported: diff -r 1aaef96dabf6 -r 90920e3f9201 usr/src/man/man1/ed.1 --- a/usr/src/man/man1/ed.1 Wed Mar 30 23:00:17 2011 -0400 +++ b/usr/src/man/man1/ed.1 Tue Mar 29 22:27:20 2011 +0000 @@ -81,16 +81,10 @@ mode, \fBno\fR commands are recognized; all input is merely collected. Leave input mode by typing a period (\fB\&.\fR) at the beginning of a line, followed immediately by a carriage return. -.SS "/usr/bin/ed" .sp .LP If \fBed\fR executes commands with arguments, it uses the default shell \fB/usr/bin/sh\fR (see \fBsh\fR(1)). -.SS "/usr/xpg4/bin/ed and /usr/xpg6/bin/ed" -.sp -.LP -If \fBed\fR executes commands with arguments, it uses \fB/usr/xpg4/bin/sh\fR -(see \fBksh\fR(1)). .SS "Regular Expressions" .sp .LP diff -r 1aaef96dabf6 -r 90920e3f9201 usr/src/man/man1/env.1 --- a/usr/src/man/man1/env.1 Wed Mar 30 23:00:17 2011 -0400 +++ b/usr/src/man/man1/env.1 Tue Mar 29 22:27:20 2011 +0000 @@ -33,16 +33,10 @@ Optional arguments are passed to \fIutility\fR. If no \fIutility\fR operand is specified, the resulting environment is written to the standard output, with one \fIname\fR\fB=\fR\fIvalue\fR pair per line. -.SS "\fB/usr/bin\fR" .sp .LP If \fBenv\fR executes commands with arguments, it uses the default shell \fB/usr/bin/sh\fR (see \fBsh\fR(1)). -.SS "\fB/usr/xpg4/bin\fR" -.sp -.LP -If \fBenv\fR executes commands with arguments, it uses \fB/usr/xpg4/bin/sh\fR -(see \fBksh\fR(1)). .SH OPTIONS .sp .LP diff -r 1aaef96dabf6 -r 90920e3f9201 usr/src/man/man1/nice.1 --- a/usr/src/man/man1/nice.1 Wed Mar 30 23:00:17 2011 -0400 +++ b/usr/src/man/man1/nice.1 Tue Mar 29 22:27:20 2011 +0000 @@ -44,16 +44,10 @@ If the C shell (see \fBcsh\fR(1)) is used, the full path of the command must be specified. Otherwise, the \fBcsh\fR built-in version of \fBnice\fR will be invoked. See \fBcsh Builtin\fR below. -.SS "/usr/bin/nice" .sp .LP If \fBnice\fR executes commands with arguments, it uses the default shell \fB/usr/bin/sh\fR (see \fBsh\fR(1)). -.SS "/usr/xpg4/bin/nice" -.sp -.LP -If \fBnice\fR executes commands with arguments, it uses \fB/usr/xpg4/bin/sh\fR -(see \fBksh\fR(1)). .SS "csh Builtin" .sp .LP diff -r 1aaef96dabf6 -r 90920e3f9201 usr/src/man/man3c/popen.3c --- a/usr/src/man/man3c/popen.3c Wed Mar 30 23:00:17 2011 -0400 +++ b/usr/src/man/man3c/popen.3c Tue Mar 29 22:27:20 2011 +0000 @@ -43,19 +43,11 @@ .sp .LP The environment of the executed command will be as if a child process were -created within the \fBpopen()\fR call using \fBfork\fR(2). If the application -is standard-conforming (see \fBstandards\fR(5)), the child is created as if -invoked with the call: +created within the \fBpopen()\fR call using \fBfork\fR(2). The child is +created as if invoked with the call: .sp .LP -\fBexecl("/usr/xpg4/bin/sh", "sh", "\fR\fB-c\fR\fB",\fR\fIcommand\fR, \fB(char -*)0);\fR -.sp -.LP -otherwise, the child is created as if invoked with the call: -.sp -.LP -\fBexecl("/usr/bin/sh", "sh", "\fR\fB-c\fR\fB",\fR\fIcommand\fR, \fB(char +\fBexecl("/usr/bin/sh", "sh", "\fR\fB-c\fR\fB", \fR\fIcommand\fR, \fB(char *)0);\fR .sp .LP diff -r 1aaef96dabf6 -r 90920e3f9201 usr/src/man/man3c/system.3c --- a/usr/src/man/man3c/system.3c Wed Mar 30 23:00:17 2011 -0400 +++ b/usr/src/man/man3c/system.3c Tue Mar 29 22:27:20 2011 +0000 @@ -31,8 +31,7 @@ .LP If \fIstring\fR is a null pointer, \fBsystem()\fR checks if the shell exists and is executable. If the shell is available, \fBsystem()\fR returns a -non-zero value; otherwise, it returns \fB0\fR. The standard to which the -caller conforms determines which shell is used. See \fBstandards\fR(5). +non-zero value; otherwise, it returns \fB0\fR. .sp .LP The \fBsystem()\fR function sets the \fBSIGINT\fR and \fBSIGQUIT\fR signals to diff -r 1aaef96dabf6 -r 90920e3f9201 usr/src/man/man5/standards.5 --- a/usr/src/man/man5/standards.5 Wed Mar 30 23:00:17 2011 -0400 +++ b/usr/src/man/man5/standards.5 Tue Mar 29 22:27:20 2011 +0000 @@ -252,29 +252,6 @@ .RE .RE -.sp -.LP -When an application uses \fBexeclp()\fR or \fBexecvp()\fR (see \fBexec\fR(2)) -to execute a shell file, or uses \fBsystem\fR(3C), the shell used to interpret -the shell file depends on the standard to which the caller conforms: -.sp - -.sp -.TS -tab(); -cw(4.33i) cw(1.17i) -lw(4.33i) lw(1.17i) -. -StandardShell Used -_ -T{ -1989 ANSI C, 1990 ISO C, 1999 ISO C, POSIX.1 (1990-2001), SUS, SUSv2, SUSv3, XPG4 -T}\fB/usr/xpg4/bin/sh\fR -T{ -POSIX.1 (1988), SVID3, XPG3, no standard specified -T}\fB/usr/bin/sh\fR -.TE - .SS "Feature Test Macros" .sp .LP