Re: bash -c exit and linux hints
[p5sagit/p5-mst-13.2.git] / pp_sys.c
index 7473ba5..4b8bfce 100644 (file)
--- a/pp_sys.c
+++ b/pp_sys.c
@@ -57,7 +57,15 @@ extern "C" int syscall(unsigned long,...);
 #if defined(HAS_SOCKET) && !defined(VMS) /* VMS handles sockets via vmsish.h */
 # include <sys/socket.h>
 # if defined(USE_SOCKS) && defined(I_SOCKS)
+#   if !defined(INCLUDE_PROTOTYPES)
+#       define INCLUDE_PROTOTYPES /* for <socks.h> */
+#       define PERL_SOCKS_NEED_PROTOTYPES
+#   endif
 #   include <socks.h>
+#   ifdef PERL_SOCKS_NEED_PROTOTYPES /* keep cpp space clean */
+#       undef INCLUDE_PROTOTYPES
+#       undef PERL_SOCKS_NEED_PROTOTYPES
+#   endif 
 # endif
 # ifdef I_NETDB
 #  include <netdb.h>
@@ -142,7 +150,7 @@ extern int h_errno;
 #    include <fcntl.h>
 #  endif
 
-#  if defined(HAS_FCNTL) && defined(F_SETLK) && defined (F_SETLKW)
+#  if defined(HAS_FCNTL) && defined(FCNTL_CAN_LOCK)
 #    define FLOCK fcntl_emulate_flock
 #    define FCNTL_EMULATE_FLOCK
 #  else /* no flock() or fcntl(F_SETLK,...) */
@@ -794,7 +802,13 @@ PP(pp_tie)
     POPSTACK;
     if (sv_isobject(sv)) {
        sv_unmagic(varsv, how);
-       sv_magic(varsv, (SvRV(sv) == varsv ? Nullsv : sv), how, Nullch, 0);
+       /* Croak if a self-tie on an aggregate is attempted. */
+       if (varsv == SvRV(sv) &&
+           (SvTYPE(sv) == SVt_PVAV ||
+            SvTYPE(sv) == SVt_PVHV))
+           Perl_croak(aTHX_
+                      "Self-ties of arrays and hashes are not supported");
+       sv_magic(varsv, sv, how, Nullch, 0);
     }
     LEAVE;
     SP = PL_stack_base + markoff;
@@ -2543,9 +2557,15 @@ PP(pp_stat)
 
     if (PL_op->op_flags & OPf_REF) {
        gv = cGVOP_gv;
-       if (PL_op->op_type == OP_LSTAT && ckWARN(WARN_IO))
-           Perl_warner(aTHX_ WARN_IO,
+       if (PL_op->op_type == OP_LSTAT) {
+           if (PL_laststype != OP_LSTAT)
+               Perl_croak(aTHX_ "The stat preceding lstat() wasn't an lstat");
+           if (ckWARN(WARN_IO) && gv != PL_defgv)
+               Perl_warner(aTHX_ WARN_IO,
                        "lstat() on filehandle %s", GvENAME(gv));
+               /* Perl_my_lstat (-l) croak's on filehandle, why warn here? */
+       }
+
       do_fstat:
        if (gv != PL_defgv) {
            PL_laststype = OP_STAT;
@@ -4972,8 +4992,10 @@ PP(pp_gpwent)
                sv_setpv(sv, spwent->sp_pwdp);
        }
 #   endif
+#   ifdef PWPASSWD
        if (!SvPOK(sv)) /* Use the standard password, then. */
            sv_setpv(sv, pwent->pw_passwd);
+#   endif
 
 #   ifndef INCOMPLETE_TAINTS
        /* passwd is tainted because user himself can diddle with it.