I accidently broke glibc's perror() - now it's working.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@11040 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -23,10 +23,10 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
|
||||||
/** Print a line on stderr consisting of the text in S, a colon,
|
/** Print a line on stderr consisting of the text in \a s, a colon,
|
||||||
* a space, a message describing the meaning of the contents of
|
* a space, a message describing the meaning of the contents of
|
||||||
* `errno' and a newline.
|
* `errno' and a newline.
|
||||||
* If S is NULL or "", the colon and space are omitted.
|
* If \a s is NULL or "", the colon and space are omitted.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -35,11 +35,17 @@ perror(const char *s)
|
|||||||
const char *colon;
|
const char *colon;
|
||||||
char buffer[1024];
|
char buffer[1024];
|
||||||
|
|
||||||
|
// ToDo: we should not change the orientation of the stream
|
||||||
|
// (wide char support is currently disabled, so this doesn't matter yet)
|
||||||
|
|
||||||
if (s == NULL || *s == '\0')
|
if (s == NULL || *s == '\0')
|
||||||
s = colon = "";
|
s = colon = "";
|
||||||
else
|
else
|
||||||
colon = ": ";
|
colon = ": ";
|
||||||
|
|
||||||
fprintf(stderr, "%s%s%s\n", s, colon, strerror_r(errno, buffer, sizeof(buffer)));
|
if (strerror_r(errno, buffer, sizeof(buffer)) != 0)
|
||||||
|
sprintf("Unknown error %ld", errno);
|
||||||
|
|
||||||
|
fprintf(stderr, "%s%s%s\n", s, colon, buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user