aboutsummaryrefslogtreecommitdiffstats
path: root/src/libmdsserver/macros.h
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2014-12-09 13:15:10 +0100
committerMattias Andrée <maandree@operamail.com>2014-12-09 13:15:10 +0100
commit7a994c9631c590d6a73c842fa5d2d3567b4771dd (patch)
tree228ade01f99ba217151a0ed20f29c5f3a5028619 /src/libmdsserver/macros.h
parentmds-kbdc: compile-layout: macro_call: fix bug: do not duplicate the arguments if there are none (diff)
parentreport an error, rather than causing failure the caller but not for the called function (diff)
downloadmds-7a994c9631c590d6a73c842fa5d2d3567b4771dd.tar.gz
mds-7a994c9631c590d6a73c842fa5d2d3567b4771dd.tar.bz2
mds-7a994c9631c590d6a73c842fa5d2d3567b4771dd.tar.xz
merge track-errors and resolve conflict
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to 'src/libmdsserver/macros.h')
-rw-r--r--src/libmdsserver/macros.h16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/libmdsserver/macros.h b/src/libmdsserver/macros.h
index 6c8f944..b72fd0a 100644
--- a/src/libmdsserver/macros.h
+++ b/src/libmdsserver/macros.h
@@ -399,11 +399,21 @@
/**
- * Go to the label `pfail` if a condition is met
+ * Go to the label `fail` if a condition is met
*
* @param ... The condition
*/
-#define fail_if(...) if (__VA_ARGS__) goto pfail
+#define fail_if(...) \
+ do \
+ if (__VA_ARGS__) \
+ { \
+ int _fail_if_saved_errno = errno; \
+ if ((errno != EMSGSIZE) && (errno != ECONNRESET) && (errno != EINTR)) \
+ fprintf(stderr, "failure at %s:%i\n", __FILE__, __LINE__); \
+ errno = _fail_if_saved_errno; \
+ goto fail; \
+ } \
+ while (0)
/**
@@ -412,7 +422,7 @@
* @param condition The condition
* @param instructions The instruction (semicolon-terminated)
*/
-#define exit_if(condition, instructions) if (condition) { instructions return 1; }
+#define exit_if(condition, instructions) do { if (condition) { instructions return 1; } } while (0)
/**