From a2a032a8ddb3ece8bcd215751ad195d5dcd28f88 Mon Sep 17 00:00:00 2001 From: Theo de Raadt Date: Tue, 30 Oct 2001 16:47:33 +0000 Subject: correct open() checks --- gnu/usr.bin/ld/ld.c | 4 ++-- gnu/usr.bin/ld/lib.c | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'gnu') 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; -- cgit v1.2.3