diff options
author | ache <ache@FreeBSD.org> | 1998-05-15 16:51:06 +0000 |
---|---|---|
committer | ache <ache@FreeBSD.org> | 1998-05-15 16:51:06 +0000 |
commit | ac3cdb08ee1f248e23564e1dcc1c837a13d0988a (patch) | |
tree | 346ed3eb4895eb63ff09a5ae1793498d4c0ac9bf /libexec/ftpd | |
parent | 2a9d8c7d6f30e4815c3107997b5e27a7f7ae1b34 (diff) | |
download | FreeBSD-src-ac3cdb08ee1f248e23564e1dcc1c837a13d0988a.zip FreeBSD-src-ac3cdb08ee1f248e23564e1dcc1c837a13d0988a.tar.gz |
Return back vfork and use execve with TZ="" environment in vfork case
Diffstat (limited to 'libexec/ftpd')
-rw-r--r-- | libexec/ftpd/popen.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/libexec/ftpd/popen.c b/libexec/ftpd/popen.c index e7e4fbf..33884b9 100644 --- a/libexec/ftpd/popen.c +++ b/libexec/ftpd/popen.c @@ -39,7 +39,7 @@ static char sccsid[] = "@(#)popen.c 8.3 (Berkeley) 4/6/94"; #endif static const char rcsid[] = - "$Id: popen.c,v 1.12 1998/05/15 16:08:52 ache Exp $"; + "$Id: popen.c,v 1.13 1998/05/15 16:30:09 ache Exp $"; #endif /* not lint */ #include <sys/types.h> @@ -79,6 +79,7 @@ ftpd_popen(program, type) FILE *iop; int argc, gargc, pdes[2], pid; char **pop, *argv[MAXUSRARGS], *gargv[MAXGLOBARGS]; + static char *envtz[2] = {"TZ=", NULL}; if (((*type != 'r') && (*type != 'w')) || type[1]) return (NULL); @@ -120,8 +121,10 @@ ftpd_popen(program, type) iop = NULL; #ifdef INTERNAL_LS fflush(NULL); + pid = (strcmp(gargv[0], _PATH_LS) == 0) ? fork() : vfork(); +#else + pid = vfork(); #endif - pid = fork(); switch(pid) { case -1: /* error */ (void)close(pdes[0]); @@ -143,8 +146,6 @@ ftpd_popen(program, type) } (void)close(pdes[1]); } - /* since FTP protocol have no way to tell zone offset */ - setenv("TZ", "", 1); #ifdef INTERNAL_LS if (strcmp(gargv[0], _PATH_LS) == 0) { extern int optreset; @@ -152,10 +153,11 @@ ftpd_popen(program, type) optreset = optind = optopt = 1; /* Close syslogging to remove pwd.db missing msgs */ closelog(); + setenv("TZ", "", 1); exit(ls_main(gargc, gargv)); } #endif - execv(gargv[0], gargv); + execve(gargv[0], gargv, envtz); _exit(1); } /* parent; assume fdopen can't fail... */ |