1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
diff -urN gamin-0.1.7/lib/gam_error.c /gnome/head/cvs/gamin/lib/gam_error.c
--- gamin-0.1.7/lib/gam_error.c 2005-09-08 09:46:45.000000000 +0200
+++ /gnome/head/cvs/gamin/lib/gam_error.c 2006-06-01 11:59:14.000000000 +0200
@@ -76,7 +76,7 @@
gam_error_init(void)
{
if (initialized == 0) {
- signal_handler prev;
+ struct sigaction oldact;
initialized = 1;
@@ -89,11 +89,12 @@
gam_error_handle_signal();
}
- prev = signal(SIGUSR2, gam_error_signal);
- /* if there is already an handler switch back to the original
- * to avoid disturbing the application behaviour */
- if ((prev != SIG_IGN) && (prev != SIG_DFL) && (prev != NULL))
- signal(SIGUSR2, prev);
+ /* if there is already an handler, leave it as is to
+ * avoid disturbing the application's behaviour */
+ if (sigaction (SIGUSR2, NULL, &oldact) == 0) {
+ if (oldact.sa_handler == NULL && oldact.sa_sigaction == NULL)
+ signal(SIGUSR2, gam_error_signal);
+ }
}
}
diff -urN gamin-0.1.7/libgamin/gam_error.c /gnome/head/cvs/gamin/libgamin/gam_error.c
--- gamin-0.1.7/libgamin/gam_error.c 2005-10-25 16:16:51.000000000 +0200
+++ /gnome/head/cvs/gamin/libgamin/gam_error.c 2006-06-01 12:00:09.000000000 +0200
@@ -76,7 +76,7 @@
gam_error_init(void)
{
if (initialized == 0) {
- signal_handler prev;
+ struct sigaction oldact;
initialized = 1;
@@ -89,11 +89,12 @@
gam_error_handle_signal();
}
- prev = signal(SIGUSR2, gam_error_signal);
- /* if there is already an handler switch back to the original
- * to avoid disturbing the application behaviour */
- if ((prev != SIG_IGN) && (prev != SIG_DFL) && (prev != NULL))
- signal(SIGUSR2, prev);
+ /* if there is already an handler, leave it as is to
+ * avoid disturbing the application's behaviour */
+ if (sigaction (SIGUSR2, NULL, &oldact) == 0) {
+ if (oldact.sa_handler == NULL && oldact.sa_sigaction == NULL)
+ signal(SIGUSR2, gam_error_signal);
+ }
}
}
|