From 66ca4b9a120a8ce4d6e704d0330f9713194b865c Mon Sep 17 00:00:00 2001 From: DTB Date: Wed, 3 Jul 2024 15:47:48 -0600 Subject: [PATCH] dj(1): remove unnecessary stderr checks --- src/dj.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/dj.c b/src/dj.c index f938ca9..8c9f327 100644 --- a/src/dj.c +++ b/src/dj.c @@ -59,11 +59,8 @@ static int write_flags = O_WRONLY | O_CREAT; #define MIN(a, b) (((a) < (b)) ? (a) : (b)) -/* Macro to check if fd is a std* file, e.g. stdin. */ -#define fdisstd(fd) \ - ((fd) == STDIN_FILENO \ - || (fd) == STDOUT_FILENO \ - || (fd) == STDERR_FILENO) +/* Macro to check if fd is stdin or stdout */ +#define fdisstd(fd) ((fd) == STDIN_FILENO || (fd) == STDOUT_FILENO) /* Fills the unused portion of io's buffer with padding, updating io->bufuse. * Returns io. */ @@ -142,7 +139,6 @@ Io_fdseek(struct Io *io){ assert(io != NULL); assert(io->fd != STDIN_FILENO || io->fl == read_flags); assert(io->fd != STDOUT_FILENO || io->fl == write_flags); - assert(io->fd != STDERR_FILENO || io->fl == write_flags); if(io->seek == 0 || (!fdisstd(io->fd) && lseek(io->fd, io->seek, SEEK_SET) != -1)){