}
if (IoIFP(thatio)) {
PerlIO *fp = IoIFP(thatio);
- /* Flush stdio buffer before dup */
+ /* Flush stdio buffer before dup. --mjd
+ * Unfortunately SEEK_CURing 0 seems to
+ * be optimized away on most platforms;
+ * only Solaris and Linux seem to flush
+ * on that. --jhi */
PerlIO_seek(fp, 0, SEEK_CUR);
+ /* On the other hand, do all platforms
+ * take gracefully to flushing a read-only
+ * filehandle? Perhaps we should do
+ * fsetpos(src)+fgetpos(dst)? --nik */
+ PerlIO_flush(fp);
fd = PerlIO_fileno(fp);
if (IoTYPE(thatio) == 's')
IoTYPE(io) = 's';
* filesize limit we would need getrlimit(). We could then
* also transparently raise the limit with setrlimit() --
* but only until the system hard limit/the filesystem limit,
- * at which we would get EPERM. --jhi */
+ * at which we would get EPERM. Note that when using buffered
+ * io the write failure can be delayed until the flush/close. --jhi */
if (len && (PerlIO_write(fp,tmps,len) == 0 || PerlIO_error(fp)))
return FALSE;
return !PerlIO_error(fp);
else
{
IV i = SvIV(astr);
- a = (char *)i; /* ouch */
+ a = INT2PTR(char *,i); /* ouch */
}
SETERRNO(0,0);
switch (optype)