From 4ff7bc3eb32e9d66312d16757fb8c083df2d87d6 Mon Sep 17 00:00:00 2001 From: deraadt Date: Fri, 28 Jun 2019 13:35:05 +0000 Subject: When system calls indicate an error they return -1, not some arbitrary value < 0. errno is only updated in this case. Change all (most?) callers of syscalls to follow this better, and let's see if this strictness helps us in the future. --- job.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'job.c') diff --git a/job.c b/job.c index 73f62359..0c316fd8 100644 --- a/job.c +++ b/job.c @@ -118,7 +118,7 @@ job_run(const char *cmd, struct session *s, const char *cwd, close(out[0]); nullfd = open(_PATH_DEVNULL, O_RDWR, 0); - if (nullfd < 0) + if (nullfd == -1) fatal("open failed"); if (dup2(nullfd, STDERR_FILENO) == -1) fatal("dup2 failed"); -- cgit v1.2.3