From db2286f6d9f8d7715a1f60437a343ffd505f8af4 Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Sat, 4 May 1996 13:57:05 +0000 Subject: * locale/setlocale.c (_nl_C_name): Variable removed. * locale/C_name.c: New file. (_nl_C_name): Put it here instead. * locale/Makefile (aux): Add C_name. * sysdeps/mach/hurd/dl-sysdep.c (open): Don't pass io port in auth_user_authenticate rpc. (open): Avoid using strtol in digit conversion for "fd/N" magic. (_dl_sysdep_start): Likewise for memobj name in magic switches. * elf/Makefile (reloc-link): New variable. (dl-allobjs.so): New target, link together $(rtld-routines). (librtld.so): Depend on that instead of the rtld components. (generated): Add dl-allobjs.so. --- sysdeps/mach/hurd/dl-sysdep.c | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) (limited to 'sysdeps') diff --git a/sysdeps/mach/hurd/dl-sysdep.c b/sysdeps/mach/hurd/dl-sysdep.c index 21f94f8..c580bb3 100644 --- a/sysdeps/mach/hurd/dl-sysdep.c +++ b/sysdeps/mach/hurd/dl-sysdep.c @@ -33,6 +33,7 @@ Cambridge, MA 02139, USA. */ #include #include #include +#include #include "dl-machine.h" @@ -139,7 +140,9 @@ unfmh(); /* XXX */ if (! memobjname) _dl_sysdep_fatal ("Bogus library spec: ", p, "\n", NULL); *memobjname++ = '\0'; - memobj = (mach_port_t) atoi (memobjname); + memobj = 0; + while (*memobjname != '\0') + memobj = (memobj * 10) + (*memobjname++ - '0'); /* Add a user reference on the memory object port, so we will still have one after _dl_map_object_from_fd calls our @@ -307,7 +310,6 @@ open (const char *file_name, int mode, ...) if (! err) err = __auth_user_authenticate (_dl_hurd_data->portarray[INIT_PORT_AUTH], - fileport, ref, MACH_MSG_TYPE_MAKE_SEND, &newpt); __mach_port_destroy (__mach_task_self (), ref); @@ -361,17 +363,19 @@ open (const char *file_name, int mode, ...) break; case 'f': - if (retryname[1] == 'd' && retryname[2] == '/') + if (retryname[1] == 'd' && retryname[2] == '/' && + isdigit (retryname[3])) { - int fd; - char *end; - err = 0; - fd = (int) strtol (retryname, &end, 10); - if (end == NULL || err || /* Malformed number. */ - /* Check for excess text after the number. A slash - is valid; it ends the component. Anything else - does not name a numeric file descriptor. */ - (*end != '/' && *end != '\0')) + /* We can't use strtol for the decoding here + because it brings in hairy locale bloat. */ + char *p; + int fd = 0; + for (p = &retryname[3]; isdigit (*p); ++p) + fd = (fd * 10) + (*p - '0'); + /* Check for excess text after the number. A slash is + valid; it ends the component. Anything else does not + name a numeric file descriptor. */ + if (*p != '/' && *p != '\0') return __hurd_fail (ENOENT); if (fd < 0 || fd >= _dl_hurd_data->dtablesize || _dl_hurd_data->dtable[fd] == MACH_PORT_NULL) @@ -380,7 +384,7 @@ open (const char *file_name, int mode, ...) of ENOENT. */ return __hurd_fail (EBADF); fileport = _dl_hurd_data->dtable[fd]; - if (*end == '\0') + if (*p == '\0') { /* This descriptor is the file port we want. */ dealloc_dir = 0; @@ -391,7 +395,7 @@ open (const char *file_name, int mode, ...) /* Do a normal retry on the remaining components. */ startdir = fileport; dealloc_dir = 1; - file_name = end + 1; /* Skip the slash. */ + file_name = p + 1; /* Skip the slash. */ break; } } @@ -448,7 +452,6 @@ open (const char *file_name, int mode, ...) if (! err) err = __auth_user_authenticate (_dl_hurd_data->portarray[INIT_PORT_AUTH], - unauth, ref, MACH_MSG_TYPE_MAKE_SEND, result); __mach_port_deallocate (__mach_task_self (), -- cgit v1.1