1
0
mirror of https://github.com/openbsd/src.git synced 2026-06-18 07:13:36 +02:00

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.
This commit is contained in:
deraadt
2019-06-28 13:47:33 +00:00
parent 8a17ffc511
commit 696e08c408
+1 -1
View File
@@ -336,7 +336,7 @@ file_tryopen(const char *file)
/* XXX check for non-regular files */
fd = open(file, O_RDONLY);
if (fd < 0) {
if (fd == -1) {
if (errno != ENOENT && errno != ENOTDIR) {
complain(NULL, "%s: %s", file, strerror(errno));
}