diff options
Diffstat (limited to 'sysdeps')
-rw-r--r-- | sysdeps/i386/elf/start.S | 10 | ||||
-rw-r--r-- | sysdeps/mach/_strerror.c | 23 |
2 files changed, 24 insertions, 9 deletions
diff --git a/sysdeps/i386/elf/start.S b/sysdeps/i386/elf/start.S index 5c29ce412a..67d7916ad6 100644 --- a/sysdeps/i386/elf/start.S +++ b/sysdeps/i386/elf/start.S @@ -49,8 +49,8 @@ _start: linked, this will not be set by anything to any function pointer; hopefully it will be zero so we don't try to call random pointers. */ - testl %edx - jeq nofini + testl %edx,%edx + jz nofini pushl %edx call atexit addl $4, %esp @@ -84,3 +84,9 @@ nofini: pushl %eax call exit /* This should never return. */ hlt /* Crash if somehow it does return. */ + +/* Define a symbol for the first piece of initialized data. */ + .data + .globl __data_start +__data_start: + .long 0 diff --git a/sysdeps/mach/_strerror.c b/sysdeps/mach/_strerror.c index 398c77fbdf..eeebb9e360 100644 --- a/sysdeps/mach/_strerror.c +++ b/sysdeps/mach/_strerror.c @@ -16,15 +16,15 @@ License along with the GNU C Library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include <ansidecl.h> #include <stdio.h> #include <string.h> #include <mach/error.h> #include <errorlib.h> +#include "../stdio/_itoa.h" /* Return a string describing the errno code in ERRNUM. */ char * -DEFUN(_strerror_internal, (errnum, buf), int errnum AND char buf[1024]) +_strerror_internal (int errnum, char buf[1024]) { int system; int sub; @@ -40,8 +40,12 @@ DEFUN(_strerror_internal, (errnum, buf), int errnum AND char buf[1024]) if (system > err_max_system || ! __mach_error_systems[system].bad_sub) { - sprintf (buf, "Unknown error system %d", system); - return buf; + static const char unk[] = "Error in unknown error system: "; + char *p = buf + sizeof buf; + *p-- = '\0'; + p = _itoa (errnum, p, 16, 1); + p -= sizeof unk - 1; + return memcpy (p, unk, sizeof unk - 1); } es = &__mach_error_systems[system]; @@ -51,9 +55,14 @@ DEFUN(_strerror_internal, (errnum, buf), int errnum AND char buf[1024]) if (code >= es->subsystem[sub].max_code) { - sprintf (buf, "Unknown error %d in system %d subsystem %d", - code, system, sub); - return buf; + static const char unk[] = "Unknown error "; + char *p = buf + sizeof buf; + size_t len = strlen (es->subsystem[sub].subsys_name); + *p-- = '\0'; + p = _itoa (errnum, p, 16, 1); + *p-- = ' '; + p = memcpy (p - len, es->subsystem[sub].subsys_name, len); + return memcpy (p - sizeof unk - 1, unk, sizeof unk - 1); } return (char *) es->subsystem[sub].codes[code]; |