diff options
author | ache <ache@FreeBSD.org> | 1994-12-18 01:18:17 +0000 |
---|---|---|
committer | ache <ache@FreeBSD.org> | 1994-12-18 01:18:17 +0000 |
commit | c26a782b4b559cbd409851e6d38d0841a6477167 (patch) | |
tree | 8a62a8f115beed3c07bd392325ca3ce97678f651 /usr.bin/strip | |
parent | 02f9caeae21bdd9d53e323f6b7e267e234763f2e (diff) | |
download | FreeBSD-src-c26a782b4b559cbd409851e6d38d0841a6477167.zip FreeBSD-src-c26a782b4b559cbd409851e6d38d0841a6477167.tar.gz |
strip not close files on error
Submitted by: jc@irbs.com
Diffstat (limited to 'usr.bin/strip')
-rw-r--r-- | usr.bin/strip/strip.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/usr.bin/strip/strip.c b/usr.bin/strip/strip.c index 7a54c96..035b034 100644 --- a/usr.bin/strip/strip.c +++ b/usr.bin/strip/strip.c @@ -39,7 +39,7 @@ static char copyright[] = #ifndef lint /*static char sccsid[] = "@(#)strip.c 8.1 (Berkeley) 6/6/93";*/ -static char RCSid[] = "$Id: strip.c,v 1.2 1994/09/03 12:58:05 csgr Exp $"; +static char RCSid[] = "$Id: strip.c,v 1.3 1994/09/08 12:27:08 bde Exp $"; #endif /* not lint */ #include <sys/types.h> @@ -99,10 +99,14 @@ main(argc, argv) if ((fd = open(fn, O_RDWR)) < 0 || (nb = read(fd, &head, sizeof(EXEC))) == -1) { err(0, "%s: %s", fn, strerror(errno)); + if (fd >= 0 && close(fd)) + err(0, "%s: %s", fn, strerror(errno)); continue; } if (nb != sizeof(EXEC) || N_BADMAG(head)) { err(0, "%s: %s", fn, strerror(EFTYPE)); + if (close(fd)) + err(0, "%s: %s", fn, strerror(errno)); continue; } sfcn(fn, fd, &head); |