add an sscanf regression test
[libc-test] / src / functional / pthread_cancel-points.c
index 4cb50d2..8b169a0 100644 (file)
@@ -4,6 +4,8 @@
 #include <semaphore.h>
 #include <string.h>
 #include <sys/mman.h>
+#include <fcntl.h>
+#include <unistd.h>
 #include "test.h"
 
 #define TESTC(c, m) ( (c) || (t_error(#c " failed (%s, " m ")\n", cdescr), 0) )
@@ -85,9 +87,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 {