]> git.ipfire.org Git - people/ms/systemd.git/blob - log.c
when resetting signal handlers, set them to SA_RESTART
[people/ms/systemd.git] / log.c
1 /*-*- Mode: C; c-basic-offset: 8 -*-*/
2
3 #ifdef HAVE_CONFIG_H
4 #include <config.h>
5 #endif
6
7 #include <stdarg.h>
8 #include <stdio.h>
9 #include <errno.h>
10
11 #include "log.h"
12
13 void log_meta(
14 int level,
15 const char*file,
16 int line,
17 const char *func,
18 const char *format, ...) {
19
20 const char *prefix, *suffix;
21 va_list ap;
22 int saved_errno = errno;
23
24 if (LOG_PRI(level) <= LOG_ERR) {
25 prefix = "\x1B[1;31m";
26 suffix = "\x1B[0m";
27 } else {
28 prefix = "";
29 suffix = "";
30 }
31
32 va_start(ap, format);
33
34 fprintf(stderr, "(%s:%u) %s", file, line, prefix);
35 vfprintf(stderr, format, ap);
36 fprintf(stderr, "%s\n", suffix);
37
38 va_end(ap);
39
40 errno = saved_errno;
41 }