fix shm subtest in cancellation points test
authorAlexander Monakov <amonakov@ispras.ru>
Thu, 11 Sep 2014 15:33:36 +0000 (17:33 +0200)
committerSzabolcs Nagy <nsz@port70.net>
Thu, 11 Sep 2014 15:35:44 +0000 (17:35 +0200)
src/functional/pthread_cancel-points.c

index 4cb50d2..eb7dac7 100644 (file)
@@ -4,6 +4,7 @@
 #include <semaphore.h>
 #include <string.h>
 #include <sys/mman.h>
+#include <fcntl.h>
 #include "test.h"
 
 #define TESTC(c, m) ( (c) || (t_error(#c " failed (%s, " m ")\n", cdescr), 0) )
@@ -85,9 +86,10 @@ static void execute_shm_open(void *arg)
 static void cleanup_shm(void *arg)
 {
        int *fd = arg;
-       if (*fd != -1)
+       if (*fd > 0) {
                TESTE(close(*fd), "shm fd");
-       TESTE(shm_unlink("/testshm"), "");
+               TESTE(shm_unlink("/testshm"), "");
+       }
 }
 
 static struct {