Handle EINTR in read/writes
All checks were successful
CI / build-and-analyze (push) Successful in 4m21s
All checks were successful
CI / build-and-analyze (push) Successful in 4m21s
This commit is contained in:
@@ -137,7 +137,10 @@ int CgeFileRead(CgeFile *file, void *buffer, size_t size, size_t *actual) {
|
|||||||
if (file->flags & CGE_FILE_ERROR)
|
if (file->flags & CGE_FILE_ERROR)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
do {
|
||||||
readed = read(file->handle, buffer, size);
|
readed = read(file->handle, buffer, size);
|
||||||
|
} while (readed < 0 && errno == EINTR);
|
||||||
|
|
||||||
if (readed < 0)
|
if (readed < 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
@@ -160,7 +163,10 @@ int CgeFileWrite(CgeFile *file, const void *buffer, size_t size,
|
|||||||
if (file->flags & CGE_FILE_ERROR)
|
if (file->flags & CGE_FILE_ERROR)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
written = write(file->handle, buffer, size);
|
do {
|
||||||
|
written = write(file->handle, buffer, size);
|
||||||
|
} while (written < 0 && errno == EINTR);
|
||||||
|
|
||||||
if (written < 0)
|
if (written < 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user