aboutsummaryrefslogtreecommitdiffstats
path: root/src/libmdsserver
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2015-08-23 03:30:46 +0200
committerMattias Andrée <maandree@operamail.com>2015-08-23 03:30:46 +0200
commit3d652087604ca1c6a66d9fa319645aeec1cf1b7b (patch)
tree0c54c322b6f053bdb4e898b6683c8190922f3539 /src/libmdsserver
parentm + colour on selected items in lists and tables (diff)
downloadmds-3d652087604ca1c6a66d9fa319645aeec1cf1b7b.tar.gz
mds-3d652087604ca1c6a66d9fa319645aeec1cf1b7b.tar.bz2
mds-3d652087604ca1c6a66d9fa319645aeec1cf1b7b.tar.xz
signal handlers that return should not modify errno
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to 'src/libmdsserver')
-rw-r--r--src/libmdsserver/macros.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/libmdsserver/macros.h b/src/libmdsserver/macros.h
index 89db22f..f17da94 100644
--- a/src/libmdsserver/macros.h
+++ b/src/libmdsserver/macros.h
@@ -752,5 +752,22 @@
#endif
+/**
+ * Normal signal handlers should place this macro
+ * at the top of the function
+ */
+#define SIGHANDLER_START \
+ int sighandler_saved_errno = errno
+
+
+/**
+ * Normal signal handlers should place this macro
+ * at the bottom of the function, or just before
+ * any `return`
+ */
+#define SIGHANDLER_END \
+ (errno = sighandler_saved_errno)
+
+
#endif