{
dTHXo;
WCHAR wMode[MODE_SIZE], wBuffer[MAX_PATH];
+ FILE *f;
if (!*filename)
return NULL;
if (USING_WIDE()) {
A2WHELPER(mode, wMode, sizeof(wMode));
A2WHELPER(filename, wBuffer, sizeof(wBuffer));
- return _wfopen(PerlDir_mapW(wBuffer), wMode);
+ f = _wfopen(PerlDir_mapW(wBuffer), wMode);
}
- return fopen(PerlDir_mapA(filename), mode);
+ else
+ f = fopen(PerlDir_mapA(filename), mode);
+ /* avoid buffering headaches for child processes */
+ if (f && *mode == 'a')
+ win32_fseek(f, 0, SEEK_END);
+ return f;
}
#ifndef USE_SOCKETS_AS_HANDLES
{
dTHXo;
WCHAR wMode[MODE_SIZE];
+ FILE *f;
if (USING_WIDE()) {
A2WHELPER(mode, wMode, sizeof(wMode));
- return _wfdopen(handle, wMode);
+ f = _wfdopen(handle, wMode);
}
- return fdopen(handle, (char *) mode);
+ else
+ f = fdopen(handle, (char *) mode);
+ /* avoid buffering headaches for child processes */
+ if (f && *mode == 'a')
+ win32_fseek(f, 0, SEEK_END);
+ return f;
}
DllExport FILE *