diff options
Diffstat (limited to 'elf/dl-load.c')
-rw-r--r-- | elf/dl-load.c | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/elf/dl-load.c b/elf/dl-load.c index 957f1b9b30..5369410d83 100644 --- a/elf/dl-load.c +++ b/elf/dl-load.c @@ -48,6 +48,7 @@ /* Code below to add offset to symbol names references itoa. */ #include <_itoa.h> +#include <not-cancel.h> #include <endian.h> #if BYTE_ORDER == BIG_ENDIAN @@ -786,7 +787,7 @@ lose (int code, int fd, const char *name, char *realname, struct link_map *l, { /* The file might already be closed. */ if (fd != -1) - (void) __close (fd); + (void) __close_nocancel (fd); if (l != NULL && l->l_origin != (char *) -1l) free ((char *) l->l_origin); free (l); @@ -1016,7 +1017,7 @@ _dl_map_object_from_fd (const char *name, const char *origname, int fd, off_t of { /* The object is already loaded. Just bump its reference count and return it. */ - __close (fd); + __close_nocancel (fd); free (realname); @@ -1045,7 +1046,7 @@ _dl_map_object_from_fd (const char *name, const char *origname, int fd, off_t of /* No need to bump the refcount of the real object, ld.so will never be unloaded. */ - __close (fd); + __close_nocancel (fd); /* Add the map for the mirrored object to the object list. */ _dl_add_to_namespace_list (l, nsid); @@ -1059,7 +1060,7 @@ _dl_map_object_from_fd (const char *name, const char *origname, int fd, off_t of /* We are not supposed to load the object unless it is already loaded. So return now. */ free (realname); - __close (fd); + __close_nocancel (fd); return NULL; } @@ -1078,7 +1079,7 @@ _dl_map_object_from_fd (const char *name, const char *origname, int fd, off_t of if (_dl_zerofd == -1) { free (realname); - __close (fd); + __close_nocancel (fd); _dl_signal_error (errno, NULL, NULL, N_("cannot open zero fill device")); } @@ -1165,7 +1166,7 @@ _dl_map_object_from_fd (const char *name, const char *origname, int fd, off_t of { phdr = alloca (maplength); __lseek (fd, header->e_phoff, SEEK_SET); - if ((size_t) __libc_read (fd, (void *) phdr, maplength) != maplength) + if ((size_t) __read_nocancel (fd, (void *) phdr, maplength) != maplength) { errstring = N_("cannot read file data"); goto call_lose_errno; @@ -1446,7 +1447,7 @@ cannot enable executable stack as shared object requires"); l->l_tls_initimage = (char *) l->l_tls_initimage + l->l_addr; /* We are done mapping in the file. We no longer need the descriptor. */ - if (__glibc_unlikely (__close (fd) != 0)) + if (__glibc_unlikely (__close_nocancel (fd) != 0)) { errstring = N_("cannot close file descriptor"); goto call_lose_errno; @@ -1660,7 +1661,7 @@ open_verify (const char *name, int fd, off_t offset, { /* An audit library changed what we're supposed to open, so FD no longer matches it. */ - __close (fd); + __close_nocancel (fd); fd = -1; } } @@ -1668,7 +1669,7 @@ open_verify (const char *name, int fd, off_t offset, if (fd == -1) /* Open the file. We always open files read-only. */ - fd = __open (name, O_RDONLY | O_CLOEXEC); + fd = __open64_nocancel (name, O_RDONLY | O_CLOEXEC); if (fd != -1) { @@ -1690,8 +1691,8 @@ open_verify (const char *name, int fd, off_t offset, /* Read in the header. */ do { - ssize_t retlen = __libc_read (fd, fbp->buf + fbp->len, - sizeof (fbp->buf) - fbp->len); + ssize_t retlen = __read_nocancel (fd, fbp->buf + fbp->len, + sizeof (fbp->buf) - fbp->len); if (retlen <= 0) break; fbp->len += retlen; @@ -1814,7 +1815,8 @@ open_verify (const char *name, int fd, off_t offset, { phdr = alloca (maplength); __lseek (fd, ehdr->e_phoff, SEEK_SET); - if ((size_t) __libc_read (fd, (void *) phdr, maplength) != maplength) + if ((size_t) __read_nocancel (fd, (void *) phdr, maplength) + != maplength) { read_error: errval = errno; @@ -1864,7 +1866,7 @@ open_verify (const char *name, int fd, off_t offset, abi_note = abi_note_malloced; } __lseek (fd, ph->p_offset, SEEK_SET); - if (__libc_read (fd, (void *) abi_note, size) != size) + if (__read_nocancel (fd, (void *) abi_note, size) != size) { free (abi_note_malloced); goto read_error; @@ -1896,7 +1898,7 @@ open_verify (const char *name, int fd, off_t offset, || (GLRO(dl_osversion) && GLRO(dl_osversion) < osversion)) { close_and_out: - __close (fd); + __close_nocancel (fd); __set_errno (ENOENT); fd = -1; } @@ -2013,7 +2015,7 @@ open_path (const char *name, size_t namelen, off_t offset, int mode, /* The shared object cannot be tested for being SUID or this bit is not set. In this case we must not use this object. */ - __close (fd); + __close_nocancel (fd); fd = -1; /* We simply ignore the file, signal this by setting the error value which would have been set by `open'. */ @@ -2034,7 +2036,7 @@ open_path (const char *name, size_t namelen, off_t offset, int mode, { /* No memory for the name, we certainly won't be able to load and link it. */ - __close (fd); + __close_nocancel (fd); return -1; } } |