summaryrefslogtreecommitdiffstats
path: root/usr.bin/xinstall/xinstall.c
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>1997-09-14 08:21:44 +0000
committerpeter <peter@FreeBSD.org>1997-09-14 08:21:44 +0000
commit7f77a9386baac6ec9e2db5c44bff263b9a75732f (patch)
tree3b66cd49d31cc78334e8ce1ece7b863a8693c70f /usr.bin/xinstall/xinstall.c
parentc9a685a905aff9932fa3b84b4b34ead5c2b4b985 (diff)
downloadFreeBSD-src-7f77a9386baac6ec9e2db5c44bff263b9a75732f.zip
FreeBSD-src-7f77a9386baac6ec9e2db5c44bff263b9a75732f.tar.gz
When calling strip, temporarily close the file, call strip and then
reopen it after strip has finished. This makes it work when /usr/bin/strip replaces the file rather than doing an in-place edit (such as the binutils-2.8 strip, which is a variation of objcopy). This is necessary if install(1) and strip(1) are going to cooperate on an ELF system.
Diffstat (limited to 'usr.bin/xinstall/xinstall.c')
-rw-r--r--usr.bin/xinstall/xinstall.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/usr.bin/xinstall/xinstall.c b/usr.bin/xinstall/xinstall.c
index a4c8da5..2889bab 100644
--- a/usr.bin/xinstall/xinstall.c
+++ b/usr.bin/xinstall/xinstall.c
@@ -42,7 +42,7 @@ static const char copyright[] =
static char sccsid[] = "From: @(#)xinstall.c 8.1 (Berkeley) 7/21/93";
#endif
static const char rcsid[] =
- "$Id: xinstall.c,v 1.23 1997/05/24 05:39:19 peter Exp $";
+ "$Id: xinstall.c,v 1.24 1997/08/27 06:29:23 charnier Exp $";
#endif /* not lint */
/*-
@@ -388,9 +388,17 @@ install(from_name, to_name, fset, flags)
(void)close(from_fd);
}
- if (dostrip)
+ if (dostrip) {
+ (void)close(to_fd);
+
strip(to_name);
+ /* Reopen target. */
+ to_fd = open(to_name, O_RDWR, 0);
+ if (to_fd < 0)
+ err(EX_OSERR, "%s", to_name);
+ }
+
/*
* Unfortunately, because we strip the installed file and not the
* original one, it is impossible to do the comparison without
OpenPOWER on IntegriCloud