summaryrefslogtreecommitdiff
path: root/libc/stdio
diff options
context:
space:
mode:
authorManuel Novoa III <mjn3@codepoet.org>2002-07-07 20:13:41 +0000
committerManuel Novoa III <mjn3@codepoet.org>2002-07-07 20:13:41 +0000
commitb815b84a5942f591e8a79c731100712558fa41c6 (patch)
treeff518c2c84178cdbf35699ca463577bf6e9dee19 /libc/stdio
parentc1383d79d31e9607a938215462f025bad3f14060 (diff)
Attempt to clean up the strerror_r situation.
Diffstat (limited to 'libc/stdio')
-rw-r--r--libc/stdio/old_vfprintf.c2
-rw-r--r--libc/stdio/printf.c2
-rw-r--r--libc/stdio/stdio.c38
3 files changed, 4 insertions, 38 deletions
diff --git a/libc/stdio/old_vfprintf.c b/libc/stdio/old_vfprintf.c
index 945f59a48..8aa9be502 100644
--- a/libc/stdio/old_vfprintf.c
+++ b/libc/stdio/old_vfprintf.c
@@ -272,7 +272,7 @@ int vfprintf(FILE * __restrict op, register const char * __restrict fmt,
if (*fmt == 'm') {
flag[FLAG_PLUS] = '\0';
flag[FLAG_0_PAD] = ' ';
- p = _stdio_strerror_r(errno, tmp, sizeof(tmp));
+ p = _glibc_strerror_r(errno, tmp, sizeof(tmp));
goto print;
}
#endif
diff --git a/libc/stdio/printf.c b/libc/stdio/printf.c
index fc6dd87bd..de50ed4e5 100644
--- a/libc/stdio/printf.c
+++ b/libc/stdio/printf.c
@@ -1220,7 +1220,7 @@ int _do_one_spec(FILE * __restrict stream, register ppfs_t *ppfs, int *count)
}
#ifdef __STDIO_PRINTF_M_SUPPORT
} else if (ppfs->conv_num == CONV_m) {
- s = _stdio_strerror_r(errno, buf, sizeof(buf));
+ s = _glibc_strerror_r(errno, buf, sizeof(buf));
goto SET_STRING_LEN;
#endif
} else {
diff --git a/libc/stdio/stdio.c b/libc/stdio/stdio.c
index a56eff777..1bce679f9 100644
--- a/libc/stdio/stdio.c
+++ b/libc/stdio/stdio.c
@@ -3218,7 +3218,7 @@ void perror(register const char *s)
{
char buf[64];
fprintf(stderr, "%s%s%s\n", s, sep,
- _stdio_strerror_r(errno, buf, sizeof(buf)));
+ _glibc_strerror_r(errno, buf, sizeof(buf)));
}
#endif
#else
@@ -3228,7 +3228,7 @@ void perror(register const char *s)
__STDIO_THREADLOCK(stderr);
_stdio_fdout(STDERR_FILENO, s, sep,
- _stdio_strerror_r(errno, buf, sizeof(buf)));
+ _glibc_strerror_r(errno, buf, sizeof(buf)));
__STDIO_THREADUNLOCK(stderr);
}
#endif
@@ -3328,37 +3328,3 @@ char *_uintmaxtostr(register char * __restrict bufend, uintmax_t uval,
#endif
/**********************************************************************/
-#ifdef L__stdio_strerror_r
-
-/* This is an internal routine, and assumes buf and buflen are set
- * appropriately.
- *
- * WARNING!!! While it is similar to the glibc strerror_r function,
- * it is not the same. It is expected that "unknown" error strings
- * will fit in the buffer passed. Also, the return value may not
- * be == buf, as unknown strings are "right-justified" in the buf
- * due to the way _int10stostr works. */
-
-static const char unknown[] = "Unknown error";
-
-char *_stdio_strerror_r(int err, register char *buf, size_t buflen)
-{
- int errsave;
-
- assert(buflen >= __UIM_BUFLEN_INT + sizeof(unknown));
-
- errsave = errno; /* Backup the errno. */
-
- if (strerror_r(err, buf, buflen)) { /* Failed! */
- __set_errno(errsave); /* Restore old errno. */
-
- buf = _int10tostr(buf+buflen-1, err) - sizeof(unknown);
- strcpy(buf, unknown);
- buf[sizeof(unknown)-1] = ' '; /* Overwrite the nul. */
- }
-
- return buf;
-}
-
-#endif
-/**********************************************************************/