dj(1): fix retvals

This commit is contained in:
dtb 2024-07-07 21:13:44 -06:00
parent 691e94c0c1
commit 5d5a6d2172
Signed by: trinity
GPG Key ID: 34C0543BBB6AF81B

View File

@ -45,9 +45,9 @@ struct Io{
size_t prec; /* partial records processed */ size_t prec; /* partial records processed */
size_t rec; /* records processed */ size_t rec; /* records processed */
long seek; /* remaining bytes to seek/skip (-sS) */ long seek; /* remaining bytes to seek/skip (-sS) */
int error; /* errno */
int fd; /* file descriptor */ int fd; /* file descriptor */
int fl; /* file opening flags */ int fl; /* file opening flags */
char error: 1; /* (bool) error status */
}; };
/* To be assigned to main:fmt and used with printio(). */ /* To be assigned to main:fmt and used with printio(). */
@ -75,7 +75,7 @@ Io_read(struct Io *io){
assert(io->bufuse < io->bs); assert(io->bufuse < io->bs);
if((t = read(io->fd, &(io->buf)[io->bufuse], io->bs - io->bufuse)) < 0){ if((t = read(io->fd, &(io->buf)[io->bufuse], io->bs - io->bufuse)) < 0){
io->error = 1; io->error = errno;
t = 0; t = 0;
} }