From root@cleat.irbs.com  Sat Dec 17 11:37:45 1994
Received: from cleat.irbs.com ([199.182.75.131]) by freefall.cdrom.com (8.6.8/8.6.6) with ESMTP id LAA17174 for <FreeBSD-gnats-submit@freebsd.org>; Sat, 17 Dec 1994 11:37:41 -0800
Received: (from root@localhost) by cleat.irbs.com (8.6.9/8.6.9) id OAA07048; Sat, 17 Dec 1994 14:37:37 -0500
Message-Id: <199412171937.OAA07048@cleat.irbs.com>
Date: Sat, 17 Dec 1994 14:37:37 -0500
From: jc@irbs.com
Reply-To: jc@irbs.com
To: FreeBSD-gnats-submit@freebsd.org
Subject: strip does not close all files
X-Send-Pr-Version: 3.2

>Number:         64
>Category:       bin
>Synopsis:       strip does not close all files
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    core (FreeBSD core team)
>State:          closed
>Quarter:
>Keywords:
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Dec 17 11:40:01 1994
>Closed-Date:    Sat Dec 17 17:18:28 PST 1994
>Last-Modified:
>Originator:     John Capo
>Release:        FreeBSD 2.1.0-Development i386
>Organization:
IRBS Engineering
>Environment:


>Description:

	strip does not close a file if there is a read error or
	the file is not a strippable file.

>How-To-Repeat:

	strip /usr/local/bin/*

>Fix:
	
*** strip.c.orig        Sat Dec 17 14:31:23 1994
--- strip.c     Sat Dec 17 14:32:16 1994
***************
*** 99,108 ****
--- 99,112 ----
                if ((fd = open(fn, O_RDWR)) < 0 ||
                    (nb = read(fd, &head, sizeof(EXEC))) == -1) {
                        err(0, "%s: %s", fn, strerror(errno));
+                       if (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);

>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: ache 
State-Changed-When: Sat Dec 17 17:18:28 PST 1994 
State-Changed-Why:  
Fixed. 
>Unformatted:



