if (file->file_handle == INVALID_HANDLE_VALUE)
{
- WLog_ERR(TAG, "Unable to set file time %s (%d)", file->fullpath, GetLastError());
+ WLog_ERR(TAG, "Unable to set file time %s (%"PRId32")", file->fullpath, GetLastError());
return FALSE;
}
if (!SetFileTime(file->file_handle, pftCreationTime, pftLastAccessTime, pftLastWriteTime))
{
- WLog_ERR(TAG, "Unable to set file time %s to %d", file->fullpath);
+ WLog_ERR(TAG, "Unable to set file time to %s", file->fullpath);
return FALSE;
}
if (file->file_handle == INVALID_HANDLE_VALUE)
{
- WLog_ERR(TAG, "Unable to truncate %s to %"PRId64" (%d)", file->fullpath, size, GetLastError());
+ WLog_ERR(TAG, "Unable to truncate %s to %"PRId64" (%"PRId32")", file->fullpath, size, GetLastError());
return FALSE;
}
if (SetFilePointer(file->file_handle, liSize.LowPart, &liSize.HighPart,
FILE_BEGIN) == INVALID_SET_FILE_POINTER)
{
- WLog_ERR(TAG, "Unable to truncate %s to %d (%d)", file->fullpath, size, GetLastError());
+ WLog_ERR(TAG, "Unable to truncate %s to %d (%"PRId32")", file->fullpath, size, GetLastError());
return FALSE;
}
if (SetEndOfFile(file->file_handle) == 0)
{
- WLog_ERR(TAG, "Unable to truncate %s to %d (%d)", file->fullpath, size, GetLastError());
+ WLog_ERR(TAG, "Unable to truncate %s to %d (%"PRId32")", file->fullpath, size, GetLastError());
return FALSE;
}
return FALSE;
size = ftell(pFile->fp);
- errno = 0;
+
if (ftruncate(fileno(pFile->fp), size) < 0)
{
WLog_ERR(TAG, "ftruncate %s failed with %s [0x%08X]",
return FALSE;
file = (WINPR_FILE *)Object;
- errno = 0;
+ clearerr(file->fp);
io_status = fread(lpBuffer, 1, nNumberOfBytesToRead, file->fp);
- if (io_status == 0 && errno != 0)
+ if (io_status == 0 && ferror(file->fp))
{
status = FALSE;
file = (WINPR_FILE *)Object;
- errno = 0;
+ clearerr(file->fp);
io_status = fwrite(lpBuffer, 1, nNumberOfBytesToWrite, file->fp);
- if (io_status == 0 && errno != 0)
+ if (io_status == 0 && ferror(file->fp))
{
SetLastError(map_posix_err(errno));
return FALSE;