libc/psignal: Output the message to STDERR_FILENO instead STDOUT_FILENO
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
parent
91f616e824
commit
e5cf5faa86
@ -27,6 +27,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
/* Uses streams... not available to kernel code */
|
/* Uses streams... not available to kernel code */
|
||||||
|
|
||||||
@ -72,15 +73,15 @@ void psignal(int signum, FAR const char *message)
|
|||||||
fprintf(stderr, "%s\n", strsignal(signum));
|
fprintf(stderr, "%s\n", strsignal(signum));
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
/* No stderr! Write to whatever alternative console is available */
|
/* No stream! Write to file handle(fd == 2) directly without buffer */
|
||||||
|
|
||||||
if (message != NULL)
|
if (message != NULL)
|
||||||
{
|
{
|
||||||
printf("%s: %s\n", message, strsignal(signum));
|
dprintf(STDERR_FILENO, "%s: %s\n", message, strsignal(signum));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
printf("%s\n", strsignal(signum));
|
dprintf(STDERR_FILENO, "%s\n", strsignal(signum));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user