summaryrefslogtreecommitdiff
path: root/pp_sys.c
diff options
context:
space:
mode:
authorCharles Bailey <bailey@newman.upenn.edu>2000-02-26 07:04:55 +0000
committerbailey <bailey@newman.upenn.edu>2000-02-26 07:04:55 +0000
commit2841d78411ddadd05a6fbe13e0be06f765fad3fb (patch)
tree5654902690bfb2994f8fe0a17c4bb3c1d7e46797 /pp_sys.c
parentcdc0122e98f2421b6507acbc7231bee768f9d260 (diff)
parentffb04cf170fa14d0606f2c3643c438d43784ee46 (diff)
downloadperl-2841d78411ddadd05a6fbe13e0be06f765fad3fb.tar.gz
Resync with mainline
p4raw-id: //depot/vmsperl@5269
Diffstat (limited to 'pp_sys.c')
-rw-r--r--pp_sys.c50
1 files changed, 30 insertions, 20 deletions
diff --git a/pp_sys.c b/pp_sys.c
index 75206c5be0..6fa9c10eac 100644
--- a/pp_sys.c
+++ b/pp_sys.c
@@ -112,27 +112,12 @@ extern int h_errno;
# include <utime.h>
# endif
#endif
-#ifdef I_FCNTL
-#include <fcntl.h>
-#endif
-#ifdef I_SYS_FILE
-#include <sys/file.h>
-#endif
/* Put this after #includes because fork and vfork prototypes may conflict. */
#ifndef HAS_VFORK
# define vfork fork
#endif
-/* Put this after #includes because <unistd.h> defines _XOPEN_*. */
-#ifndef Sock_size_t
-# if _XOPEN_VERSION >= 5 || defined(_XOPEN_SOURCE_EXTENDED) || defined(__GLIBC__)
-# define Sock_size_t Size_t
-# else
-# define Sock_size_t int
-# endif
-#endif
-
#ifdef HAS_CHSIZE
# ifdef my_chsize /* Probably #defined to Perl_my_chsize in embed.h */
# undef my_chsize
@@ -943,7 +928,7 @@ PP(pp_sselect)
/* If SELECT_MIN_BITS is greater than one we most probably will want
* to align the sizes with SELECT_MIN_BITS/8 because for example
* in many little-endian (Intel, Alpha) systems (Linux, OS/2, Digital
- * UNIX, Solaris, NeXT, Rhapsody) the smallest quantum select() operates
+ * UNIX, Solaris, NeXT, Darwin) the smallest quantum select() operates
* on (sets/tests/clears bits) is 32 bits. */
growsize = maxlen + (SELECT_MIN_BITS/8 - (maxlen % (SELECT_MIN_BITS/8)));
# else
@@ -2042,6 +2027,9 @@ PP(pp_socket)
if (!IoIFP(io) && !IoOFP(io)) PerlLIO_close(fd);
RETPUSHUNDEF;
}
+#if defined(HAS_FCNTL) && defined(F_SETFD)
+ fcntl(fd, F_SETFD, fd > PL_maxsysfd); /* ensure close-on-exec */
+#endif
RETPUSHYES;
#else
@@ -2092,6 +2080,10 @@ PP(pp_sockpair)
if (!IoIFP(io2) && !IoOFP(io2)) PerlLIO_close(fd[1]);
RETPUSHUNDEF;
}
+#if defined(HAS_FCNTL) && defined(F_SETFD)
+ fcntl(fd[0],F_SETFD,fd[0] > PL_maxsysfd); /* ensure close-on-exec */
+ fcntl(fd[1],F_SETFD,fd[1] > PL_maxsysfd); /* ensure close-on-exec */
+#endif
RETPUSHYES;
#else
@@ -2254,6 +2246,9 @@ PP(pp_accept)
if (!IoIFP(nstio) && !IoOFP(nstio)) PerlLIO_close(fd);
goto badexit;
}
+#if defined(HAS_FCNTL) && defined(F_SETFD)
+ fcntl(fd, F_SETFD, fd > PL_maxsysfd); /* ensure close-on-exec */
+#endif
PUSHp((char *)&saddr, len);
RETURN;
@@ -3372,12 +3367,19 @@ S_dooneliner(pTHX_ char *cmd, char *filename)
PP(pp_mkdir)
{
djSP; dTARGET;
- int mode = POPi;
+ int mode;
#ifndef HAS_MKDIR
int oldumask;
#endif
STRLEN n_a;
- char *tmps = SvPV(TOPs, n_a);
+ char *tmps;
+
+ if (MAXARG > 1)
+ mode = POPi;
+ else
+ mode = 0777;
+
+ tmps = SvPV(TOPs, n_a);
TAINT_PROPER("mkdir");
#ifdef HAS_MKDIR
@@ -4712,7 +4714,7 @@ PP(pp_gpwuid)
PP(pp_gpwent)
{
djSP;
-#if defined(HAS_PASSWD) && defined(HAS_GETPWENT)
+#ifdef HAS_PASSWD
I32 which = PL_op->op_type;
register SV *sv;
struct passwd *pwent;
@@ -4726,7 +4728,11 @@ PP(pp_gpwent)
else if (which == OP_GPWUID)
pwent = getpwuid(POPi);
else
+#ifdef HAS_GETPWENT
pwent = (struct passwd *)getpwent();
+#else
+ DIE(aTHX_ PL_no_func, "getpwent");
+#endif
#ifdef HAS_GETSPNAM
if (which == OP_GPWNAM) {
@@ -4878,7 +4884,7 @@ PP(pp_ggrgid)
PP(pp_ggrent)
{
djSP;
-#if defined(HAS_GROUP) && defined(HAS_GETGRENT)
+#ifdef HAS_GROUP
I32 which = PL_op->op_type;
register char **elem;
register SV *sv;
@@ -4890,7 +4896,11 @@ PP(pp_ggrent)
else if (which == OP_GGRGID)
grent = (struct group *)getgrgid(POPi);
else
+#ifdef HAS_GETGRENT
grent = (struct group *)getgrent();
+#else
+ DIE(aTHX_ PL_no_func, "getgrent");
+#endif
EXTEND(SP, 4);
if (GIMME != G_ARRAY) {