Skip to content

Commit e018a8e

Browse files
committed
cleanup of stdiop fsync
1 parent f63410c commit e018a8e

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

main/streams/plain_wrapper.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -524,19 +524,21 @@ static int php_stdiop_sync(php_stream *stream)
524524
{
525525
php_stdio_stream_data *data = (php_stdio_stream_data*)stream->abstract;
526526
FILE *fp;
527+
int fd;
527528

528529
if (php_stream_cast(stream, PHP_STREAM_AS_STDIO, (void**)&fp, REPORT_ERRORS) == FAILURE) {
529-
return 1;
530+
return -1;
530531
}
531532

532533
if (php_stdiop_flush(stream) == 0) {
534+
PHP_STDIOP_GET_FD(fd, data);
533535
#ifdef PHP_WIN32
534-
return _commit(fileno(fp));
536+
return _commit(fd);
535537
#else
536-
return fsync(fileno(fp));
538+
return fsync(fd);
537539
#endif
538540
}
539-
return 1;
541+
return -1;
540542
}
541543

542544
static int php_stdiop_flush(php_stream *stream)

0 commit comments

Comments
 (0)