*tend-- = '\0';
if (num_svs) {
/* New style explict name, type is just mode and discipline/layer info */
- STRLEN l;
+ STRLEN l = 0;
name = SvOK(*svp) ? SvPV(*svp, l) : "";
len = (I32)l;
name = savepvn(name, len);
if (ckWARN(WARN_IO)) {
if ((IoTYPE(io) == IoTYPE_RDONLY) &&
(fp == PerlIO_stdout() || fp == PerlIO_stderr())) {
- Perl_warner(aTHX_ WARN_IO, "'std%s' opened only for input",
- (fp == PerlIO_stdout()) ? "out" : "err");
+ Perl_warner(aTHX_ WARN_IO,
+ "Filehandle STD%s opened only for input",
+ (fp == PerlIO_stdout()) ? "OUT" : "ERR");
}
else if ((IoTYPE(io) == IoTYPE_WRONLY) && fp == PerlIO_stdin()) {
- Perl_warner(aTHX_ WARN_IO, "'stdin' opened only for output");
+ Perl_warner(aTHX_ WARN_IO,
+ "Filehandle STDIN opened only for output");
}
}
if (savefd != fd) {
Pid_t pid;
SV *sv;
- PerlLIO_dup2(fd, savefd);
+ if (PerlLIO_dup2(fd, savefd) < 0) {
+ (void)PerlIO_close(fp);
+ goto say_false;
+ }
#ifdef VMS
if (savefd != PerlIO_fileno(PerlIO_stdin())) {
char newname[FILENAME_MAX+1];
if (!SvUTF8(sv))
sv_utf8_upgrade(sv = sv_mortalcopy(sv));
}
- else if (DO_UTF8(sv))
- sv_utf8_downgrade((sv = sv_mortalcopy(sv)), FALSE);
+ else if (DO_UTF8(sv)) {
+ if (!sv_utf8_downgrade((sv = sv_mortalcopy(sv)), TRUE)) {
+ Perl_warner(aTHX_ WARN_UTF8, "Wide character in print");
+ }
+ }
tmps = SvPV(sv, len);
break;
}