From c6ed36e16dcdd4c25349e4f9d5c84061095ccffb Mon Sep 17 00:00:00 2001 From: Stephen Potter Date: Wed, 18 Mar 1998 04:06:55 -0600 Subject: Re: doc: perlrun typo Date: Wed, 18 Mar 1998 10:06:55 -0600 Subject: Re: [PATCH 5.004_63] PerlLIO abstraction cleanup Date: Tue, 24 Mar 1998 21:20:51 -0600 p4raw-id: //depot/perl@842 --- perl.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'perl.c') diff --git a/perl.c b/perl.c index 326ad0da49..f8217ff1fa 100644 --- a/perl.c +++ b/perl.c @@ -1861,7 +1861,7 @@ open_script(char *scriptname, bool dosearch, SV *sv) #endif DEBUG_p(PerlIO_printf(Perl_debug_log, "Looking for %s\n",cur)); - if (Stat(cur,&statbuf) >= 0) { + if (PerlLIO_stat(cur,&statbuf) >= 0) { dosearch = 0; scriptname = cur; #ifdef SEARCH_EXTS @@ -1929,7 +1929,7 @@ open_script(char *scriptname, bool dosearch, SV *sv) do { #endif DEBUG_p(PerlIO_printf(Perl_debug_log, "Looking for %s\n",tokenbuf)); - retval = Stat(tokenbuf,&statbuf); + retval = PerlLIO_stat(tokenbuf,&statbuf); #ifdef SEARCH_EXTS } while ( retval < 0 /* not there */ && extidx>=0 && ext[extidx] /* try an extension? */ @@ -1952,7 +1952,7 @@ open_script(char *scriptname, bool dosearch, SV *sv) xfailed = savepv(tokenbuf); } #ifndef DOSISH - if (!xfound && !seen_dot && !xfailed && (Stat(scriptname,&statbuf) < 0)) + if (!xfound && !seen_dot && !xfailed && (PerlLIO_stat(scriptname,&statbuf) < 0)) #endif seen_dot = 1; /* Disable message. */ if (!xfound) @@ -2077,7 +2077,7 @@ sed %s -e \"/^[^#]/b\" \ if (!rsfp) { #ifdef DOSUID #ifndef IAMSUID /* in case script is not readable before setuid */ - if (euid && Stat(SvPVX(GvSV(curcop->cop_filegv)),&statbuf) >= 0 && + if (euid && PerlLIO_stat(SvPVX(GvSV(curcop->cop_filegv)),&statbuf) >= 0 && statbuf.st_mode & (S_ISUID|S_ISGID)) { /* try again */ PerlProc_execv(form("%s/sperl%s", BIN_EXP, patchlevel), origargv); @@ -2155,7 +2155,7 @@ validate_suid(char *validarg, char *scriptname) #endif || getuid() != euid || geteuid() != uid) croak("Can't swap uid and euid"); /* really paranoid */ - if (Stat(SvPVX(GvSV(curcop->cop_filegv)),&tmpstatbuf) < 0) + if (PerlLIO_stat(SvPVX(GvSV(curcop->cop_filegv)),&tmpstatbuf) < 0) croak("Permission denied"); /* testing full pathname here */ if (tmpstatbuf.st_dev != statbuf.st_dev || tmpstatbuf.st_ino != statbuf.st_ino) { @@ -2749,7 +2749,7 @@ incpush(char *p, int addsubdirs) /* .../archname/version if -d .../archname/version/auto */ sv_setsv(subdir, libdir); sv_catpv(subdir, archpat_auto); - if (Stat(SvPVX(subdir), &tmpstatbuf) >= 0 && + if (PerlLIO_stat(SvPVX(subdir), &tmpstatbuf) >= 0 && S_ISDIR(tmpstatbuf.st_mode)) av_push(GvAVn(incgv), newSVpv(SvPVX(subdir), SvCUR(subdir) - sizeof "auto")); @@ -2757,7 +2757,7 @@ incpush(char *p, int addsubdirs) /* .../archname if -d .../archname/auto */ sv_insert(subdir, SvCUR(libdir) + sizeof(ARCHNAME), strlen(patchlevel) + 1, "", 0); - if (Stat(SvPVX(subdir), &tmpstatbuf) >= 0 && + if (PerlLIO_stat(SvPVX(subdir), &tmpstatbuf) >= 0 && S_ISDIR(tmpstatbuf.st_mode)) av_push(GvAVn(incgv), newSVpv(SvPVX(subdir), SvCUR(subdir) - sizeof "auto")); -- cgit v1.2.1 From 51fa4eeaa214f639610700d3b2aea14f2933be35 Mon Sep 17 00:00:00 2001 From: Jarkko Hietaniemi Date: Thu, 19 Mar 1998 01:21:08 +0200 Subject: 5.004_63: further -e patching p4raw-id: //depot/perl@846 --- perl.c | 36 +++++++++++++++++++++++++++++------- 1 file changed, 29 insertions(+), 7 deletions(-) (limited to 'perl.c') diff --git a/perl.c b/perl.c index f8217ff1fa..0536829016 100644 --- a/perl.c +++ b/perl.c @@ -24,6 +24,13 @@ char *getenv _((char *)); /* Usually in */ #endif +#ifdef I_FCNTL +#include +#endif +#ifdef I_SYS_FILE +#include +#endif + dEXTCONST char rcsid[] = "perl.c\nPatch level: ###\n"; #ifdef IAMSUID @@ -679,21 +686,36 @@ setuid perl scripts securely.\n"); if (euid != uid || egid != gid) croak("No -e allowed in setuid scripts"); if (!e_fp) { +#ifdef HAS_UMASK + int oldumask = PerlLIO_umask(0177); +#endif e_tmpname = savepv(TMPPATH); #ifdef HAS_MKSTEMP e_tmpfd = PerlLIO_mkstemp(e_tmpname); - - if (e_tmpfd < 0) - croak("Can't mkstemp() temporary file \"%s\"", e_tmpname); - e_fp = PerlIO_fdopen(e_tmpfd,"w"); #else /* use mktemp() */ (void)PerlLIO_mktemp(e_tmpname); if (!*e_tmpname) - croak("Can't mktemp() temporary file \"%s\"", e_tmpname); + croak("Cannot generate temporary filename"); +# if defined(HAS_OPEN3) && defined(O_EXCL) + e_tmpfd = open(e_tmpname, + O_WRONLY | O_CREAT | O_EXCL, + 0600); +# else + (void)UNLINK(e_tmpname); + /* Yes, potential race. But at least we can say we tried. */ e_fp = PerlIO_open(e_tmpname,"w"); -#endif /* HAS_MKSTEMP */ +# endif +#endif /* ifdef HAS_MKSTEMP */ +#if defined(HAS_MKSTEMP) || (defined(HAS_OPEN3) && defined(O_EXCL)) + if (e_tmpfd < 0) + croak("Cannot create temporary file \"%s\"", e_tmpname); + e_fp = PerlIO_fdopen(e_tmpfd,"w"); +#endif if (!e_fp) - croak("Cannot open temporary file \"%s\"", e_tmpname); + croak("Cannot create temporary file \"%s\"", e_tmpname); +#ifdef HAS_UMASK + (void)PerlLIO_umask(oldumask); +#endif } if (*++s) PerlIO_puts(e_fp,s); -- cgit v1.2.1 From ec12f1140dd78d67c95825bf881ff58a52e9d030 Mon Sep 17 00:00:00 2001 From: Jan-Pieter Cornet Date: Fri, 27 Mar 1998 03:11:21 +0100 Subject: Re: [PATCH] [BUG 5.004_63] define/set of PERL_DESTRUCT_LEVEL Date: Fri, 27 Mar 1998 02:11:21 +0100 (MET) Subject: [PATCH] another destruct_level fix Date: Mon, 30 Mar 1998 23:48:12 +0200 (MET DST) p4raw-id: //depot/perl@855 --- perl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'perl.c') diff --git a/perl.c b/perl.c index 0536829016..00321af164 100644 --- a/perl.c +++ b/perl.c @@ -497,7 +497,7 @@ perl_destruct(register PerlInterpreter *sv_interp) if (hent) { warn("Unbalanced string table refcount: (%d) for \"%s\"", HeVAL(hent) - Nullsv, HeKEY(hent)); - HeVAL(hent) = Nullsv; + HeVAL(hent) = &sv_undef; hent = HeNEXT(hent); } if (!hent) { -- cgit v1.2.1