mirror of
https://github.com/apache/nuttx.git
synced 2026-08-11 07:25:13 +00:00
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
1 changed files with 4 additions and 3 deletions
|
|
@ -27,6 +27,7 @@
|
|||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
|
||||
/* 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));
|
||||
}
|
||||
#else
|
||||
/* No stderr! Write to whatever alternative console is available */
|
||||
/* No stream! Write to file handle(fd == 2) directly without buffer */
|
||||
|
||||
if (message != NULL)
|
||||
{
|
||||
printf("%s: %s\n", message, strsignal(signum));
|
||||
dprintf(STDERR_FILENO, "%s: %s\n", message, strsignal(signum));
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("%s\n", strsignal(signum));
|
||||
dprintf(STDERR_FILENO, "%s\n", strsignal(signum));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue