szn

Bug 437 — load-buffer fails on EINTR instead of retrying read()

437. load-buffer fails on EINTR instead of retrying read()

Severity: MEDIUM Status: Fixed

cmdLoadBuffer reads the file in a loop but treats any negative return from std.c.read as a hard failure:

// src/cmd/cmd.zig:550-575
while (true) {
    const n = std.c.read(fd, &chunk, chunk.len);
    if (n < 0) return .err; // EINTR (and other transient errors) abort here
    if (n == 0) break;
    // ... appendSlice into data ...
}

Problem & Impact

Proposed Fix

Distinguish EINTR from real errors and continue the loop on EINTR (or use errno and retry). Optionally loop on EAGAIN as well, consistent with the rest of the I/O surface.