From ce2f70896ea09b3a891e66c7a774928420994194 Mon Sep 17 00:00:00 2001 From: Mikhail Romanko Date: Mon, 27 Jul 2026 13:12:24 +0300 Subject: [PATCH] Handle EINTR in read/writes --- posix/File.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/posix/File.c b/posix/File.c index 215428f..21e79b5 100644 --- a/posix/File.c +++ b/posix/File.c @@ -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; - written = write(file->handle, buffer, size); + do { + written = write(file->handle, buffer, size); + } while (written < 0 && errno == EINTR); + if (written < 0) goto error;