HCoop
/
bpt
/
emacs.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Another merge from trunk.
[bpt/emacs.git]
/
src
/
unexaix.c
diff --git
a/src/unexaix.c
b/src/unexaix.c
index
da44480
..
fc1acc9
100644
(file)
--- a/
src/unexaix.c
+++ b/
src/unexaix.c
@@
-42,6
+42,7
@@
what you give them. Help stamp out software-hoarding! */
#include <config.h>
#include "unexec.h"
#include <config.h>
#include "unexec.h"
+#include "lisp.h"
#define PERROR(file) report_error (file, new)
#include <a.out.h>
#define PERROR(file) report_error (file, new)
#include <a.out.h>
@@
-59,8
+60,6
@@
what you give them. Help stamp out software-hoarding! */
#include <unistd.h>
#include <fcntl.h>
#include <unistd.h>
#include <fcntl.h>
-#include "mem-limits.h"
-
extern char _data[];
extern char _text[];
extern char _data[];
extern char _text[];
@@
-95,13
+94,10
@@
static int pagemask;
static _Noreturn void
report_error (const char *file, int fd)
{
static _Noreturn void
report_error (const char *file, int fd)
{
+ int err = errno;
if (fd)
if (fd)
- {
- int failed_errno = errno;
- close (fd);
- errno = failed_errno;
- }
- report_file_error ("Cannot unexec", Fcons (build_string (file), Qnil));
+ emacs_close (fd);
+ report_file_errno ("Cannot unexec", build_string (file), err);
}
#define ERROR0(msg) report_error_1 (new, msg)
}
#define ERROR0(msg) report_error_1 (new, msg)
@@
-112,7
+108,7
@@
static _Noreturn void ATTRIBUTE_FORMAT_PRINTF (2, 3)
report_error_1 (int fd, const char *msg, ...)
{
va_list ap;
report_error_1 (int fd, const char *msg, ...)
{
va_list ap;
- close (fd);
+
emacs_
close (fd);
va_start (ap, msg);
verror (msg, ap);
va_end (ap);
va_start (ap, msg);
verror (msg, ap);
va_end (ap);
@@
-134,11
+130,11
@@
unexec (const char *new_name, const char *a_name)
{
int new = -1, a_out = -1;
{
int new = -1, a_out = -1;
- if (a_name && (a_out =
open (a_name, O_RDONLY
)) < 0)
+ if (a_name && (a_out =
emacs_open (a_name, O_RDONLY, 0
)) < 0)
{
PERROR (a_name);
}
{
PERROR (a_name);
}
- if ((new =
creat (new_name
, 0666)) < 0)
+ if ((new =
emacs_open (new_name, O_WRONLY | O_CREAT | O_TRUNC
, 0666)) < 0)
{
PERROR (new_name);
}
{
PERROR (new_name);
}
@@
-149,13
+145,13
@@
unexec (const char *new_name, const char *a_name)
|| adjust_lnnoptrs (new, a_out, new_name) < 0
|| unrelocate_symbols (new, a_out, a_name, new_name) < 0)
{
|| adjust_lnnoptrs (new, a_out, new_name) < 0
|| unrelocate_symbols (new, a_out, a_name, new_name) < 0)
{
- close (new);
+
emacs_
close (new);
return;
}
return;
}
- close (new);
+
emacs_
close (new);
if (a_out >= 0)
if (a_out >= 0)
- close (a_out);
+
emacs_
close (a_out);
mark_x (new_name);
}
mark_x (new_name);
}
@@
-505,7
+501,7
@@
adjust_lnnoptrs (int writedesc, int readdesc, const char *new_name)
if (!lnnoptr || !f_hdr.f_symptr)
return 0;
if (!lnnoptr || !f_hdr.f_symptr)
return 0;
- if ((new =
open (new_name, O_RDWR
)) < 0)
+ if ((new =
emacs_open (new_name, O_RDWR, 0
)) < 0)
{
PERROR (new_name);
return -1;
{
PERROR (new_name);
return -1;
@@
-535,7
+531,7
@@
adjust_lnnoptrs (int writedesc, int readdesc, const char *new_name)
}
}
}
}
}
}
- close (new);
+
emacs_
close (new);
return 0;
}
return 0;
}