summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@derf.homelinux.org>2010-06-09 11:22:54 +0200
committerDaniel Friesel <derf@derf.homelinux.org>2010-06-09 11:22:54 +0200
commit5d1564dff78fc76471913da8c55cc0c90f25d0f8 (patch)
treeeb88b30cd661e08a9bedb970feb1900c090f81b4
parent78a066bc2f66367f590425828ebc5bae32bb8407 (diff)
error checking in signals.c + Add signals to documentation
-rw-r--r--man/feh.111
-rw-r--r--src/signals.c21
2 files changed, 27 insertions, 5 deletions
diff --git a/man/feh.1 b/man/feh.1
index aef10a7..e408e92 100644
--- a/man/feh.1
+++ b/man/feh.1
@@ -677,6 +677,17 @@ the mouse. The zoom will always happen so that the pixel on which you entered
the zoom mode remains stationary. So, to enlarge a specific part of an image,
click the zoom button on that part.
.
+.Sh SIGNALS
+In slideshow mode,
+.Nm
+handles the following signals:
+.Bl -tag -width indent
+.It SIGUSR1
+Switch to next image
+.It SIGUSR2
+Switch to previous image
+.El
+.
.Sh USAGE EXAMPLES
Here are some examples of useful option combinations
.Bl -tag -width indent
diff --git a/src/signals.c b/src/signals.c
index 4e51c77..eca77e6 100644
--- a/src/signals.c
+++ b/src/signals.c
@@ -34,15 +34,26 @@ void setup_signal_handlers()
sigset_t feh_ss;
D_ENTER(4);
- sigemptyset(&feh_ss);
- sigaddset(&feh_ss, SIGUSR1);
- sigaddset(&feh_ss, SIGUSR2);
+ if (
+ (sigemptyset(&feh_ss) == -1) ||
+ (sigaddset(&feh_ss, SIGUSR1) == -1) ||
+ (sigaddset(&feh_ss, SIGUSR2) == -1))
+ {
+ weprintf("Failed to set up signal mask, SIGUSR1/2 won't work");
+ D_RETURN_(4);
+ }
feh_sh.sa_handler = feh_handle_signal;
feh_sh.sa_mask = feh_ss;
- sigaction(SIGUSR1, &feh_sh, NULL);
- sigaction(SIGUSR2, &feh_sh, NULL);
+ if (
+ (sigaction(SIGUSR1, &feh_sh, NULL) == -1) ||
+ (sigaction(SIGUSR2, &feh_sh, NULL) == -1))
+ {
+ weprintf("Failed to set up signal handler, SIGUSR1/2 won't work");
+ D_RETURN_(4);
+ }
+
D_RETURN_(4);
}