dj(1): remove unnecessary stderr checks
This commit is contained in:
parent
3897f44cf8
commit
66ca4b9a12
8
src/dj.c
8
src/dj.c
|
@ -59,11 +59,8 @@ static int write_flags = O_WRONLY | O_CREAT;
|
||||||
|
|
||||||
#define MIN(a, b) (((a) < (b)) ? (a) : (b))
|
#define MIN(a, b) (((a) < (b)) ? (a) : (b))
|
||||||
|
|
||||||
/* Macro to check if fd is a std* file, e.g. stdin. */
|
/* Macro to check if fd is stdin or stdout */
|
||||||
#define fdisstd(fd) \
|
#define fdisstd(fd) ((fd) == STDIN_FILENO || (fd) == STDOUT_FILENO)
|
||||||
((fd) == STDIN_FILENO \
|
|
||||||
|| (fd) == STDOUT_FILENO \
|
|
||||||
|| (fd) == STDERR_FILENO)
|
|
||||||
|
|
||||||
/* Fills the unused portion of io's buffer with padding, updating io->bufuse.
|
/* Fills the unused portion of io's buffer with padding, updating io->bufuse.
|
||||||
* Returns io. */
|
* Returns io. */
|
||||||
|
@ -142,7 +139,6 @@ Io_fdseek(struct Io *io){
|
||||||
assert(io != NULL);
|
assert(io != NULL);
|
||||||
assert(io->fd != STDIN_FILENO || io->fl == read_flags);
|
assert(io->fd != STDIN_FILENO || io->fl == read_flags);
|
||||||
assert(io->fd != STDOUT_FILENO || io->fl == write_flags);
|
assert(io->fd != STDOUT_FILENO || io->fl == write_flags);
|
||||||
assert(io->fd != STDERR_FILENO || io->fl == write_flags);
|
|
||||||
|
|
||||||
if(io->seek == 0
|
if(io->seek == 0
|
||||||
|| (!fdisstd(io->fd) && lseek(io->fd, io->seek, SEEK_SET) != -1)){
|
|| (!fdisstd(io->fd) && lseek(io->fd, io->seek, SEEK_SET) != -1)){
|
||||||
|
|
Loading…
Reference in New Issue
Block a user