1 /*
2 * Copyright (c) 2016 Red Hat, Inc.
3 *
4 * All rights reserved.
5 *
6 * Author: Jan Pokorny <jpokorny@redhat.com>
7 *
8 * This file is part of libqb.
9 *
10 * libqb is free software: you can redistribute it and/or modify
11 * it under the terms of the GNU Lesser General Public License as published by
12 * the Free Software Foundation, either version 2.1 of the License, or
13 * (at your option) any later version.
14 *
15 * libqb is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public License
21 * along with libqb. If not, see <http://www.gnu.org/licenses/>.
22 */
23
24 #include "_syslog_override.h"
25
26 #include <limits.h>
27 #include <string.h>
28
29 int _syslog_opened = 0;
30 int _syslog_option = 0;
31 int _syslog_facility = 0;
32 char _syslog_ident[PATH_MAX] = "";
33
34 void openlog(const char *ident, int option, int facility);
35
36 void
openlog(const char * ident,int option,int facility)37 openlog(const char *ident, int option, int facility)
38 {
39 _syslog_opened = 1;
40 _syslog_option = option;
41 _syslog_facility = facility;
42 strncpy(_syslog_ident, ident, sizeof(_syslog_ident)-1);
43 }
44
45 void syslog(int priority, const char *format, ...);
46
47 void
syslog(int priority,const char * format,...)48 syslog(int priority, const char *format, ...)
49 {
50 _syslog_opened = 1;
51 }
52
53 void closelog(void);
54
55 void
closelog(void)56 closelog(void)
57 {
58 _syslog_opened = 0;
59 _syslog_option = -1;
60 _syslog_facility = -1;
61 _syslog_ident[0] = '\0';
62 }
63