summaryrefslogtreecommitdiffstats
path: root/libdaemon/dsignal.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2008-07-28 20:50:57 +0200
committerLennart Poettering <lennart@poettering.net>2008-07-28 20:50:57 +0200
commit7892e9b63584b3bc9965e1d4e7d0188ba6fab8c5 (patch)
treef7ad3f144958609f92973fc3cd4ce812cae1a50f /libdaemon/dsignal.c
parentfbfaf950e6299952f9d2add5bb69c617f0bd91a9 (diff)
update licenses/file headers
Diffstat (limited to 'libdaemon/dsignal.c')
-rw-r--r--libdaemon/dsignal.c57
1 files changed, 28 insertions, 29 deletions
diff --git a/libdaemon/dsignal.c b/libdaemon/dsignal.c
index 781aa00..a759464 100644
--- a/libdaemon/dsignal.c
+++ b/libdaemon/dsignal.c
@@ -1,23 +1,22 @@
-/* $Id$ */
-
-/*
- * This file is part of libdaemon.
- *
- * libdaemon is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * libdaemon is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with libdaemon; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA
- */
+/***
+ This file is part of libdaemon.
+
+ Copyright 2003-2008 Lennart Poettering
+
+ libdaemon is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation, either version 2.1 of the
+ License, or (at your option) any later version.
+
+ libdaemon is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with libdaemon. If not, see
+ <http://www.gnu.org/licenses/>.
+***/
#ifdef HAVE_CONFIG_H
#include <config.h>
@@ -63,7 +62,7 @@ int daemon_signal_install(int s){
if (_init() < 0)
return -1;
-
+
if (sigemptyset(&ss) < 0) {
daemon_log(LOG_ERR, "sigemptyset(): %s", strerror(errno));
return -1;
@@ -83,7 +82,7 @@ int daemon_signal_install(int s){
sa.sa_handler = _sigfunc;
sigemptyset(&sa.sa_mask);
sa.sa_flags = SA_RESTART;
-
+
if (sigaction(s, &sa, NULL) < 0) {
daemon_log(LOG_ERR, "sigaction(%s, ...) failed: %s", strsignal(s), strerror(errno));
return -1;
@@ -94,7 +93,7 @@ int daemon_signal_install(int s){
int daemon_signal_init(int s, ...) {
int sig, r = 0;
-
+
va_list ap;
va_start(ap, s);
@@ -107,19 +106,19 @@ int daemon_signal_init(int s, ...) {
r = -1;
break;
}
-
+
sig = va_arg(ap, int);
}
-
+
va_end(ap);
-
+
return r;
}
void daemon_signal_done(void) {
if (_signal_pipe[0] != -1)
close(_signal_pipe[0]);
-
+
if (_signal_pipe[1] != -1)
close(_signal_pipe[1]);
@@ -132,7 +131,7 @@ int daemon_signal_next(void) {
if ((r = read(_signal_pipe[0], &s, sizeof(s))) == sizeof(s))
return s;
-
+
if (r < 0) {
if (errno == EAGAIN)
@@ -142,7 +141,7 @@ int daemon_signal_next(void) {
return -1;
}
}
-
+
daemon_log(LOG_ERR, "Short read() on signal pipe.");
return -1;
}