summaryrefslogtreecommitdiff
path: root/src/shared/barrier.h
diff options
context:
space:
mode:
authorDavid Herrmann <dh.herrmann@gmail.com>2014-10-02 08:31:28 +0200
committerDavid Herrmann <dh.herrmann@gmail.com>2014-10-02 08:40:43 +0200
commitfc808616227115ccab8c04f00f8f7472c7353ae5 (patch)
tree5a3602427608b7fb975dacdc19579a28261d0ec1 /src/shared/barrier.h
parentdda57d9143644d39091207b287f142f91f55d0ad (diff)
barrier: fix up constructor error handling
We cannot rely on "errno" to be non-zero on failure, if we perform multiple glibc calls. That is, if the first eventfd() call fails, but the second succeeds, we cleanup the barrier but return 0. Fix this by always testing the return value immediately. This should also fix all the coverity warnings.
Diffstat (limited to 'src/shared/barrier.h')
-rw-r--r--src/shared/barrier.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/shared/barrier.h b/src/shared/barrier.h
index 53b4439fb2..c55e311344 100644
--- a/src/shared/barrier.h
+++ b/src/shared/barrier.h
@@ -62,6 +62,8 @@ struct Barrier {
int barrier_create(Barrier *obj);
void barrier_destroy(Barrier *b);
+DEFINE_TRIVIAL_CLEANUP_FUNC(Barrier*, barrier_destroy);
+
void barrier_set_role(Barrier *b, unsigned int role);
bool barrier_place(Barrier *b);