diff options
author | Tony Cook <tony@develop-help.com> | 2014-05-12 13:55:36 +1000 |
---|---|---|
committer | Tony Cook <tony@develop-help.com> | 2014-05-28 10:31:12 +1000 |
commit | 7cb3f9598b37fcd8b30ea273d668c8b48d5f4c76 (patch) | |
tree | 3a1635f819dcc4eb6a2869ba1166d63b899759c4 /doio.c | |
parent | 4ac9c666a62d8b538b58e38bb7539c40ca7ffb9b (diff) | |
download | perl-7cb3f9598b37fcd8b30ea273d668c8b48d5f4c76.tar.gz |
[perl #121112] only warn if newline is the last non-NUL character
Diffstat (limited to 'doio.c')
-rw-r--r-- | doio.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -617,7 +617,7 @@ S_openn_cleanup(pTHX_ GV *gv, IO *io, PerlIO *fp, char *mode, const char *oname, if (!fp) { if (IoTYPE(io) == IoTYPE_RDONLY && ckWARN(WARN_NEWLINE) - && strchr(oname, '\n') + && should_warn_nl(oname) ) { @@ -1407,7 +1407,7 @@ Perl_my_stat_flags(pTHX_ const U32 flags) s = SvPVX_const(PL_statname); /* s now NUL-terminated */ PL_laststype = OP_STAT; PL_laststatval = PerlLIO_stat(s, &PL_statcache); - if (PL_laststatval < 0 && ckWARN(WARN_NEWLINE) && strchr(s, '\n')) { + if (PL_laststatval < 0 && ckWARN(WARN_NEWLINE) && should_warn_nl(s)) { GCC_DIAG_IGNORE(-Wformat-nonliteral); /* PL_warn_nl is constant */ Perl_warner(aTHX_ packWARN(WARN_NEWLINE), PL_warn_nl, "stat"); GCC_DIAG_RESTORE; @@ -1470,7 +1470,7 @@ Perl_my_lstat_flags(pTHX_ const U32 flags) file = SvPV_flags_const_nolen(sv, flags); sv_setpv(PL_statname,file); PL_laststatval = PerlLIO_lstat(file,&PL_statcache); - if (PL_laststatval < 0 && ckWARN(WARN_NEWLINE) && strchr(file, '\n')) { + if (PL_laststatval < 0 && ckWARN(WARN_NEWLINE) && should_warn_nl(file)) { GCC_DIAG_IGNORE(-Wformat-nonliteral); /* PL_warn_nl is constant */ Perl_warner(aTHX_ packWARN(WARN_NEWLINE), PL_warn_nl, "lstat"); GCC_DIAG_RESTORE; |