remove cruft for supposedly-buggy clang from or1k & microblaze syscall_arch
[musl.git] / src / signal / psignal.c
blob138dbe00fa07825936a4a59676ea89a8b3c673b4
1 #include "stdio_impl.h"
2 #include <string.h>
3 #include <signal.h>
4 #include <errno.h>
6 void psignal(int sig, const char *msg)
8 FILE *f = stderr;
9 char *s = strsignal(sig);
11 FLOCK(f);
13 /* Save stderr's orientation and encoding rule, since psignal is not
14 * permitted to change them. Save errno and restore it if there is no
15 * error since fprintf might change it even on success but psignal is
16 * not permitted to do so. */
17 void *old_locale = f->locale;
18 int old_mode = f->mode;
19 int old_errno = errno;
21 if (fprintf(f, "%s%s%s\n", msg?msg:"", msg?": ":"", s)>=0)
22 errno = old_errno;
23 f->mode = old_mode;
24 f->locale = old_locale;
26 FUNLOCK(f);