* src/unexelf.c
@ 2005-10-02 18:54 Aubrey Jaffer
0 siblings, 0 replies; only message in thread
From: Aubrey Jaffer @ 2005-10-02 18:54 UTC (permalink / raw)
#ifndef emacs
#define fatal(a, b, c) fprintf (stderr, a, b, c), exit (1)
but some of the calls to fatal() have different numbers of arguments.
This patch fixes those calls.
-=-=-=-
*** unexelf.c.~1.58.~ 2005-10-02 14:47:28.000000000 -0400
--- unexelf.c 2005-10-02 14:51:00.337130032 -0400
***************
*** 702,708 ****
#if MAP_ANON == 0
mmap_fd = open ("/dev/zero", O_RDONLY);
if (mmap_fd < 0)
! fatal ("Can't open /dev/zero for reading: errno %d\n", errno);
#endif
/* We cannot use malloc here because that may use sbrk. If it does,
--- 702,708 ----
#if MAP_ANON == 0
mmap_fd = open ("/dev/zero", O_RDONLY);
if (mmap_fd < 0)
! fatal ("Can't open /dev/zero for reading: errno %d\n", errno, 0);
#endif
/* We cannot use malloc here because that may use sbrk. If it does,
***************
*** 713,719 ****
old_base = mmap (NULL, old_file_size, PROT_READ | PROT_WRITE,
MAP_ANON | MAP_PRIVATE, mmap_fd, 0);
if (old_base == MAP_FAILED)
! fatal ("Can't allocate buffer for %s\n", old_name);
if (read (old_file, old_base, stat_buf.st_size) != stat_buf.st_size)
fatal ("Didn't read all of %s: errno %d\n", old_name, errno);
--- 713,719 ----
old_base = mmap (NULL, old_file_size, PROT_READ | PROT_WRITE,
MAP_ANON | MAP_PRIVATE, mmap_fd, 0);
if (old_base == MAP_FAILED)
! fatal ("Can't allocate buffer for %s\n", old_name, 0);
if (read (old_file, old_base, stat_buf.st_size) != stat_buf.st_size)
fatal ("Didn't read all of %s: errno %d\n", old_name, errno);
***************
*** 802,808 ****
new_base = mmap (NULL, new_file_size, PROT_READ | PROT_WRITE,
MAP_ANON | MAP_PRIVATE, mmap_fd, 0);
if (new_base == MAP_FAILED)
! fatal ("Can't allocate buffer for %s\n", old_name);
new_file_h = (ElfW(Ehdr) *) new_base;
new_program_h = (ElfW(Phdr) *) ((byte *) new_base + old_file_h->e_phoff);
--- 802,808 ----
new_base = mmap (NULL, new_file_size, PROT_READ | PROT_WRITE,
MAP_ANON | MAP_PRIVATE, mmap_fd, 0);
if (new_base == MAP_FAILED)
! fatal ("Can't allocate buffer for %s\n", old_name, 0);
new_file_h = (ElfW(Ehdr) *) new_base;
new_program_h = (ElfW(Phdr) *) ((byte *) new_base + old_file_h->e_phoff);
***************
*** 1079,1085 ****
&& old_mdebug_index != -1)
{
int diff = NEW_SECTION_H(nn).sh_offset
! - OLD_SECTION_H(old_mdebug_index).sh_offset;
HDRR *phdr = (HDRR *)(NEW_SECTION_H (nn).sh_offset + new_base);
if (diff)
--- 1079,1085 ----
&& old_mdebug_index != -1)
{
int diff = NEW_SECTION_H(nn).sh_offset
! - OLD_SECTION_H(old_mdebug_index).sh_offset;
HDRR *phdr = (HDRR *)(NEW_SECTION_H (nn).sh_offset + new_base);
if (diff)
***************
*** 1257,1265 ****
/* Write out new_file, and free the buffers. */
if (write (new_file, new_base, new_file_size) != new_file_size)
fatal ("Didn't write %d bytes to %s: errno %d\n",
new_file_size, new_base, errno);
!
munmap (old_base, old_file_size);
munmap (new_base, new_file_size);
--- 1257,1269 ----
/* Write out new_file, and free the buffers. */
if (write (new_file, new_base, new_file_size) != new_file_size)
+ #ifndef emacs
+ fatal ("Didn't write %d bytes: errno %d\n",
+ new_file_size, errno);
+ #else
fatal ("Didn't write %d bytes to %s: errno %d\n",
new_file_size, new_base, errno);
! #endif
munmap (old_base, old_file_size);
munmap (new_base, new_file_size);
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2005-10-02 18:54 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-10-02 18:54 src/unexelf.c Aubrey Jaffer
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).