This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
make tr/// threadsafe by moving swash into pad
[perl5.git] / doio.c
diff --git a/doio.c b/doio.c
index ef16b07..49b1fed 100644 (file)
--- a/doio.c
+++ b/doio.c
@@ -1,7 +1,7 @@
 /*    doio.c
  *
  *    Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- *    2000, 2001, 2002, 2003, 2004, 2005, 2006, by Larry Wall and others
+ *    2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, by Larry Wall and others
  *
  *    You may distribute under the terms of either the GNU General Public
  *    License or the Artistic License, as specified in the README file.
@@ -787,7 +787,7 @@ Perl_nextargv(pTHX_ register GV *gv)
                        if (ckWARN_d(WARN_INPLACE))     
                            Perl_warner(aTHX_ packWARN(WARN_INPLACE),
                              "Can't do inplace edit: %"SVf" would not be unique",
-                             sv);
+                             SVfARG(sv));
                        do_close(gv,FALSE);
                        continue;
                    }
@@ -798,7 +798,7 @@ Perl_nextargv(pTHX_ register GV *gv)
                        if (ckWARN_d(WARN_INPLACE))     
                            Perl_warner(aTHX_ packWARN(WARN_INPLACE),
                              "Can't rename %s to %"SVf": %s, skipping file",
-                             PL_oldname, (void*)sv, Strerror(errno));
+                             PL_oldname, SVfARG(sv), Strerror(errno));
                        do_close(gv,FALSE);
                        continue;
                    }
@@ -815,7 +815,7 @@ Perl_nextargv(pTHX_ register GV *gv)
                        if (ckWARN_d(WARN_INPLACE))     
                            Perl_warner(aTHX_ packWARN(WARN_INPLACE),
                              "Can't rename %s to %"SVf": %s, skipping file",
-                             PL_oldname, sv, Strerror(errno) );
+                             PL_oldname, SVfARG(sv), Strerror(errno) );
                        do_close(gv,FALSE);
                        continue;
                    }
@@ -1288,7 +1288,12 @@ Perl_my_stat(pTHX)
                 return (PL_laststatval = PerlLIO_fstat(dirfd(IoDIRP(io)), &PL_statcache));
 #else
                 Perl_die(aTHX_ PL_no_func, "dirfd");
-                NORETURN_FUNCTION_END;
+               /* NOT REACHED */
+               return 0;
+               /* Can't use NORETURN_FUNCTION_END because Perl_die is not
+                *     __attribute__noreturn__
+                * Can't use DIE because that does not return an integer
+                */
 #endif
             } else {
                 if (ckWARN2(WARN_UNOPENED,WARN_CLOSED))
@@ -1333,8 +1338,6 @@ Perl_my_stat(pTHX)
            Perl_warner(aTHX_ packWARN(WARN_NEWLINE), PL_warn_nl, "stat");
        return PL_laststatval;
     }
-    /* Should we warn/croak here? Or do something smart/useful? */
-    return (PL_laststatval = -1);
 }
 
 
@@ -1449,11 +1452,13 @@ Perl_do_exec3(pTHX_ const char *incmd, int fd, int do_report)
     dVAR;
     register char **a;
     register char *s;
+    char *buf;
     char *cmd;
 
     /* Make a copy so we can change it */
     const Size_t cmdlen = strlen(incmd) + 1;
-    Newx(cmd, cmdlen, char);
+    Newx(buf, cmdlen, char);
+    cmd = buf;
     my_strlcpy(cmd, incmd, cmdlen);
 
     while (*cmd && isSPACE(*cmd))
@@ -1488,7 +1493,7 @@ Perl_do_exec3(pTHX_ const char *incmd, int fd, int do_report)
                  PERL_FPU_POST_EXEC
                  *s = '\'';
                  S_exec_failed(aTHX_ PL_cshname, fd, do_report);
-                 Safefree(cmd);
+                 Safefree(buf);
                  return FALSE;
              }
          }
@@ -1536,7 +1541,7 @@ Perl_do_exec3(pTHX_ const char *incmd, int fd, int do_report)
            PerlProc_execl(PL_sh_path, "sh", "-c", cmd, (char *)NULL);
            PERL_FPU_POST_EXEC
            S_exec_failed(aTHX_ PL_sh_path, fd, do_report);
-           Safefree(cmd);
+           Safefree(buf);
            return FALSE;
        }
     }
@@ -1566,7 +1571,7 @@ Perl_do_exec3(pTHX_ const char *incmd, int fd, int do_report)
        S_exec_failed(aTHX_ PL_Argv[0], fd, do_report);
     }
     do_execfree();
-    Safefree(cmd);
+    Safefree(buf);
     return FALSE;
 }