summaryrefslogtreecommitdiffstats
path: root/gnu/usr.bin
diff options
context:
space:
mode:
authorbde <bde@FreeBSD.org>1995-09-28 19:43:22 +0000
committerbde <bde@FreeBSD.org>1995-09-28 19:43:22 +0000
commit7b21039a71d27d24df672740c642830438c642e3 (patch)
treef587f561eda0c9ec8d977abd4d5d6b2881a0af3a /gnu/usr.bin
parente3ddcec186fca9b8c4d6da5f04daed4e7a07e35f (diff)
downloadFreeBSD-src-7b21039a71d27d24df672740c642830438c642e3.zip
FreeBSD-src-7b21039a71d27d24df672740c642830438c642e3.tar.gz
Fix checks for open() failing. open() may successfully return 0.
ld.c: Fix a an error message that said that open() failed after fopen() failed.
Diffstat (limited to 'gnu/usr.bin')
-rw-r--r--gnu/usr.bin/ld/ld.c6
-rw-r--r--gnu/usr.bin/ld/lib.c6
2 files changed, 6 insertions, 6 deletions
diff --git a/gnu/usr.bin/ld/ld.c b/gnu/usr.bin/ld/ld.c
index 20bb152..8fafef1 100644
--- a/gnu/usr.bin/ld/ld.c
+++ b/gnu/usr.bin/ld/ld.c
@@ -32,7 +32,7 @@ static char sccsid[] = "@(#)ld.c 6.10 (Berkeley) 5/22/91";
Set, indirect, and warning symbol features added by Randy Smith. */
/*
- * $Id: ld.c,v 1.28 1995/06/14 06:25:09 joerg Exp $
+ * $Id: ld.c,v 1.29 1995/07/13 08:30:07 rgrimes Exp $
*/
/* Define how to initialize system-dependent header fields. */
@@ -959,7 +959,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;
@@ -2475,7 +2475,7 @@ write_output()
outstream = fopen(output_filename, "w");
if (outstream == NULL)
- err(1, "open: %s", output_filename);
+ err(1, "fopen: %s", output_filename);
if (atexit(cleanup))
err(1, "atexit");
diff --git a/gnu/usr.bin/ld/lib.c b/gnu/usr.bin/ld/lib.c
index 78d6926..5e119ba 100644
--- a/gnu/usr.bin/ld/lib.c
+++ b/gnu/usr.bin/ld/lib.c
@@ -1,5 +1,5 @@
/*
- * $Id: lib.c,v 1.14 1995/04/07 05:08:28 nate Exp $ - library routines
+ * $Id: lib.c,v 1.15 1995/05/30 05:01:46 rgrimes Exp $ - library routines
*/
#include <sys/param.h>
@@ -830,7 +830,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;
@@ -852,7 +852,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;
OpenPOWER on IntegriCloud