dns response handling: ignore presence of wrong-type RRs
[musl] / src / signal / psignal.c
1 #include "stdio_impl.h"
2 #include <string.h>
3 #include <signal.h>
4 #include <errno.h>
5
6 void psignal(int sig, const char *msg)
7 {
8         FILE *f = stderr;
9         char *s = strsignal(sig);
10
11         FLOCK(f);
12
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;
20
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;
25
26         FUNLOCK(f);
27 }