summaryrefslogtreecommitdiff
path: root/src/unexaix.c
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2014-12-20 13:11:40 -0800
committerPaul Eggert <eggert@cs.ucla.edu>2014-12-20 13:12:20 -0800
commit9b14d8b6f259a4d602f0c61689d6641e7ab20b49 (patch)
treef631a2165d1201cb75ed3e362464a5ae2610bfc5 /src/unexaix.c
parentb459f1f0b970b640bbc1f3827115a18be2dcef7f (diff)
downloademacs-9b14d8b6f259a4d602f0c61689d6641e7ab20b49.tar.gz
Simplify unexec file mode setting
* unexaix.c, unexcoff.c, unexelf.c, unexmacosx.c: Don't include <sys/stat.h> when no longer needed. (unexec): Create file with correct mode in the first place, rather than overwriting the mode later and fiddling with the global umask in the mean time. Avoid bogus usage like 'umask (777)', which should have been 'umask (0777)'. (mark_x): Remove. All callers removed.
Diffstat (limited to 'src/unexaix.c')
-rw-r--r--src/unexaix.c27
1 files changed, 1 insertions, 26 deletions
diff --git a/src/unexaix.c b/src/unexaix.c
index c97d5cae2a8..fd36e4a73a6 100644
--- a/src/unexaix.c
+++ b/src/unexaix.c
@@ -55,7 +55,6 @@ what you give them. Help stamp out software-hoarding! */
#include <inttypes.h>
#include <stdarg.h>
#include <stdio.h>
-#include <sys/stat.h>
#include <errno.h>
#include <unistd.h>
#include <fcntl.h>
@@ -134,7 +133,7 @@ unexec (const char *new_name, const char *a_name)
{
PERROR (a_name);
}
- if ((new = emacs_open (new_name, O_WRONLY | O_CREAT | O_TRUNC, 0666)) < 0)
+ if ((new = emacs_open (new_name, O_WRONLY | O_CREAT | O_TRUNC, 0777)) < 0)
{
PERROR (new_name);
}
@@ -152,7 +151,6 @@ unexec (const char *new_name, const char *a_name)
emacs_close (new);
if (a_out >= 0)
emacs_close (a_out);
- mark_x (new_name);
}
/* ****************************************************************
@@ -466,29 +464,6 @@ copy_sym (int new, int a_out, const char *a_name, const char *new_name)
return 0;
}
-/* ****************************************************************
- * mark_x
- *
- * After successfully building the new a.out, mark it executable
- */
-static void
-mark_x (const char *name)
-{
- struct stat sbuf;
- int um;
- int new = 0; /* for PERROR */
-
- um = umask (777);
- umask (um);
- if (stat (name, &sbuf) == -1)
- {
- PERROR (name);
- }
- sbuf.st_mode |= 0111 & ~um;
- if (chmod (name, sbuf.st_mode) == -1)
- PERROR (name);
-}
-
static int
adjust_lnnoptrs (int writedesc, int readdesc, const char *new_name)
{