Handle EINTR in read/writes

This commit is contained in:
blankhex committed 2026-07-27 13:12:24 +03:00
1 parent 7e97383d0d
commit ce2f70896e
1 file changed
+6
+6
View File
@@ -137,7 +137,10 @@ int CgeFileRead(CgeFile *file, void *buffer, size_t size, size_t *actual) {
if (file->flags & CGE_FILE_ERROR)
return 0;
do {
readed = read(file->handle, buffer, size);
} while (readed < 0 && errno == EINTR);
if (readed < 0)
goto error;
@@ -160,7 +163,10 @@ int CgeFileWrite(CgeFile *file, const void *buffer, size_t size,
if (file->flags & CGE_FILE_ERROR)
return 0;
do {
written = write(file->handle, buffer, size);
} while (written < 0 && errno == EINTR);
if (written < 0)
goto error;