Util: include assert.h in pthreads_nosig.h when required
authorJeffrey Altman <jaltman@your-file-system.com>
Thu, 14 Oct 2010 22:18:40 +0000 (18:18 -0400)
committerJeffrey Altman <jaltman@openafs.org>
Fri, 15 Oct 2010 06:30:59 +0000 (23:30 -0700)
If assert() will be used within pthreads_nosig.h, include assert.h.
Also, permit assert() to be a macro that is a no-op by always evaluating
the expression.

Change-Id: I8c790dcb8cb98f75028343e5de94b91ab891daad
Reviewed-on: http://gerrit.openafs.org/2988
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Tested-by: Jeffrey Altman <jaltman@openafs.org>

src/util/pthread_nosigs.h

index f8932d2..1d63896 100644 (file)
@@ -59,6 +59,7 @@
 #endif
 #define AFS_SIGSET_CLEAR() \
 do { \
+         int b; \
         sigfillset(&i_tset); \
          _SETSEGV \
          _SETBUS \
@@ -66,12 +67,14 @@ do { \
          _SETTRAP \
          _SETABRT \
          _SETFPE \
-        assert(AFS_SET_SIGMASK(SIG_BLOCK, &i_tset, &i_oset) == 0); \
+        b = (AFS_SET_SIGMASK(SIG_BLOCK, &i_tset, &i_oset) == 0); \
+         assert(b); \
 } while (0)
 
 #define AFS_SIGSET_RESTORE() \
 do { \
-        assert(AFS_SET_SIGMASK(SIG_SETMASK, &i_oset, NULL) == 0); \
+        int b = (AFS_SET_SIGMASK(SIG_SETMASK, &i_oset, NULL) == 0); \
+         assert(b); \
 } while (0)
 #endif /* AFS_NT40_ENV */