From 7f77a9386baac6ec9e2db5c44bff263b9a75732f Mon Sep 17 00:00:00 2001 From: peter Date: Sun, 14 Sep 1997 08:21:44 +0000 Subject: 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. --- usr.bin/xinstall/xinstall.c | 12 ++++++++++-- 1 file 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 -- cgit v1.1