← Commit list

dd4686128

Martin Lewis
Martin Lewis
2019-10-09
SUCCESS Duration: 149s

Subject

libbb: Converted safe_read to safe_write format

Binary

No binary (build failed)

Architecture & Compiler Flags

Architecture: x86_64-linux-gnu Compiler: gcc (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0

—

Build Log

(log yok)

Commit Diff GitHub →

libbb/read.c+10 -2
@@ -12,9 +12,17 @@ ssize_t FAST_FUNC safe_read(int fd, void *buf, size_t count)
{
ssize_t n;
- do {
+ for (;;) {
n = read(fd, buf, count);
- } while (n < 0 && errno == EINTR);
+ if (n >= 0 || errno != EINTR)
+ break;
+ /* Some callers set errno=0, are upset when they see EINTR.
+ * Returning EINTR is wrong since we retry read(),
+ * the "error" was transient.
+ */
+ errno = 0;
+ /* repeat the read() */
+ }
return n;
}