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.
This commit is contained in:
Peter Wemm 1997-09-14 08:21:44 +00:00
parent 87963de0e4
commit 387dcb61ff
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=29379

View File

@ -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