summaryrefslogtreecommitdiff
path: root/gnu
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2001-10-30 16:47:33 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2001-10-30 16:47:33 +0000
commita2a032a8ddb3ece8bcd215751ad195d5dcd28f88 (patch)
tree05f292992f250c92cab31bdc454e8023ac7f77f0 /gnu
parentc147918221a6ac1da3927ad9b9d9f89269bae5d1 (diff)
correct open() checks
Diffstat (limited to 'gnu')
-rw-r--r--gnu/usr.bin/ld/ld.c4
-rw-r--r--gnu/usr.bin/ld/lib.c6
2 files changed, 5 insertions, 5 deletions
diff --git a/gnu/usr.bin/ld/ld.c b/gnu/usr.bin/ld/ld.c
index 7856a21893a..9fb3f621eaa 100644
--- a/gnu/usr.bin/ld/ld.c
+++ b/gnu/usr.bin/ld/ld.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ld.c,v 1.18 2001/07/08 17:49:44 espie Exp $ */
+/* $OpenBSD: ld.c,v 1.19 2001/10/30 16:47:32 deraadt Exp $ */
/* $NetBSD: ld.c,v 1.52 1998/02/20 03:12:51 jonathan Exp $ */
/*-
@@ -1039,7 +1039,7 @@ file_open(entry)
} else
fd = open(entry->filename, O_RDONLY, 0);
- if (fd > 0) {
+ if (fd >= 0) {
input_file = entry;
input_desc = fd;
return fd;
diff --git a/gnu/usr.bin/ld/lib.c b/gnu/usr.bin/ld/lib.c
index 6a57d7b511b..01967ab7edf 100644
--- a/gnu/usr.bin/ld/lib.c
+++ b/gnu/usr.bin/ld/lib.c
@@ -1,4 +1,4 @@
-/* * $OpenBSD: lib.c,v 1.3 2001/08/30 10:42:01 espie Exp $ - library routines*/
+/* * $OpenBSD: lib.c,v 1.4 2001/10/30 16:47:32 deraadt Exp $ - library routines*/
/*
*/
@@ -817,7 +817,7 @@ struct file_entry *p;
fname = findshlib(p->filename, &major, &minor, 1);
- if (fname && (fd = open(fname, O_RDONLY, 0)) > 0) {
+ if (fname && (fd = open(fname, O_RDONLY, 0)) >= 0) {
p->filename = fname;
p->lib_major = major;
p->lib_minor = minor;
@@ -839,7 +839,7 @@ dot_a:
register char *path
= concat(search_dirs[i], "/", fname);
fd = open(path, O_RDONLY, 0);
- if (fd > 0) {
+ if (fd >= 0) {
p->filename = path;
p->flags &= ~E_SEARCH_DIRS;
break;