X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/d7aff0d6929c16d15992304dd44c5f528df8f895..ed19f207449c43f7f08285ada87ae7a46c61c8d1:/src/unexaix.c diff --git a/src/unexaix.c b/src/unexaix.c index fc1acc9ab4..c2012f77ca 100644 --- a/src/unexaix.c +++ b/src/unexaix.c @@ -1,13 +1,13 @@ /* Dump an executable image. - Copyright (C) 1985-1988, 1999, 2001-2013 Free Software Foundation, + Copyright (C) 1985-1988, 1999, 2001-2016 Free Software Foundation, Inc. This file is part of GNU Emacs. GNU Emacs is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. +the Free Software Foundation, either version 3 of the License, or (at +your option) any later version. GNU Emacs is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -55,7 +55,6 @@ what you give them. Help stamp out software-hoarding! */ #include #include #include -#include #include #include #include @@ -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); } /* **************************************************************** @@ -379,7 +377,7 @@ copy_text_and_data (int new) char *ptr; lseek (new, text_scnptr, SEEK_SET); - ptr = _text + text_scnptr; + ptr = _text; end = ptr + f_ohdr.tsize; write_segment (new, ptr, end); @@ -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) { @@ -606,7 +581,7 @@ unrelocate_symbols (int new, int a_out, PERROR (a_name); } - p = (int *) (ldrel.l_vaddr + d_reloc); + p = (int *) (intptr_t) (ldrel.l_vaddr + d_reloc); switch (ldrel.l_symndx) { case SYMNDX_TEXT: