aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRodney W. Grimes <rgrimes@FreeBSD.org>1995-07-07 05:45:26 +0000
committerRodney W. Grimes <rgrimes@FreeBSD.org>1995-07-07 05:45:26 +0000
commitafbae9e280eb63dcf30592ce21ffd69494df46ec (patch)
tree1628a144cf192167559a2b6bd079cfd738b81b9e
parente93145a03b292341bdb157e0ad4b5eb3b4d7ccd9 (diff)
downloadsrc-afbae9e280eb63dcf30592ce21ffd69494df46ec.tar.gz
src-afbae9e280eb63dcf30592ce21ffd69494df46ec.zip
Branch: RELENG_2_0_5
cvs update -j 1.27.4.1 ld.c: ---------------------------- revision 1.27.4.1 date: 1995/06/28 05:54:50; author: davidg; state: Exp; lines: +7 -3 (2.1.0 branch) Bring in changes from 1.28 - don't ignore umask when setting 'x'. Submitted by: Jeorg Wunsch ----------------------------
Notes
Notes: svn path=/releng/2.0.5/; revision=9416
-rw-r--r--gnu/usr.bin/ld/ld.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/gnu/usr.bin/ld/ld.c b/gnu/usr.bin/ld/ld.c
index a1f81ad0e2c8..e8107cc658a1 100644
--- a/gnu/usr.bin/ld/ld.c
+++ b/gnu/usr.bin/ld/ld.c
@@ -32,7 +32,7 @@ static char sccsid[] = "@(#)ld.c 6.10 (Berkeley) 5/22/91";
Set, indirect, and warning symbol features added by Randy Smith. */
/*
- * $Id: ld.c,v 1.26 1995/03/10 19:41:50 davidg Exp $
+ * $Id: ld.c,v 1.27.4.1 1995/06/28 05:54:50 davidg Exp $
*/
/* Define how to initialize system-dependent header fields. */
@@ -2463,12 +2463,16 @@ write_output()
{
struct stat statbuf;
int filemode;
-
+ mode_t u_mask;
+
if (lstat(output_filename, &statbuf) == 0) {
if (S_ISREG(statbuf.st_mode))
(void)unlink(output_filename);
}
+ u_mask = umask(0);
+ (void)umask(u_mask);
+
outstream = fopen(output_filename, "w");
if (outstream == NULL)
err(1, "open: %s", output_filename);
@@ -2502,7 +2506,7 @@ write_output()
/* Output the RSS section */
write_rrs();
- if (chmod (output_filename, filemode | 0111) == -1)
+ if (chmod (output_filename, filemode | (0111 & ~u_mask)) == -1)
err(1, "chmod: %s", output_filename);
fflush(outstream);