From ac3cdb08ee1f248e23564e1dcc1c837a13d0988a Mon Sep 17 00:00:00 2001 From: ache Date: Fri, 15 May 1998 16:51:06 +0000 Subject: Return back vfork and use execve with TZ="" environment in vfork case --- libexec/ftpd/popen.c | 12 +++++++----- 1 file 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 @@ -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... */ -- cgit v1.1