diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2019-06-28 13:32:54 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2019-06-28 13:32:54 +0000 |
commit | 86ffccf24f66032a89d70a32b3609584c0db7345 (patch) | |
tree | 2ae97fac6ea5be57cc953baf8612e8f683da0172 /lib/libc/gen/nlist.c | |
parent | ce9fea47562d4f179d45680d6aec00ede2877141 (diff) |
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.
Diffstat (limited to 'lib/libc/gen/nlist.c')
-rw-r--r-- | lib/libc/gen/nlist.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/libc/gen/nlist.c b/lib/libc/gen/nlist.c index 9a65ea3a66a..da66558a1f6 100644 --- a/lib/libc/gen/nlist.c +++ b/lib/libc/gen/nlist.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nlist.c,v 1.70 2019/05/13 17:18:10 guenther Exp $ */ +/* $OpenBSD: nlist.c,v 1.71 2019/06/28 13:32:41 deraadt Exp $ */ /* * Copyright (c) 1989, 1993 * The Regents of the University of California. All rights reserved. @@ -102,7 +102,7 @@ __fdnlist(int fd, struct nlist *list) /* Make sure obj is OK */ if (pread(fd, &ehdr, sizeof(Elf_Ehdr), 0) != sizeof(Elf_Ehdr) || - !__elf_is_okay__(&ehdr) || fstat(fd, &st) < 0) + !__elf_is_okay__(&ehdr) || fstat(fd, &st) == -1) return (-1); /* calculate section header table size */ @@ -293,7 +293,7 @@ nlist(const char *name, struct nlist *list) int fd, n; fd = open(name, O_RDONLY | O_CLOEXEC); - if (fd < 0) + if (fd == -1) return (-1); n = __fdnlist(fd, list); (void)close(fd); |