fls: use local namespace to do not clash with FreeBSD string.h
[lttng-ust.git] / libringbuffer / shm.c
index 994204d1e0a2463829a8e73e3cb0cf078eae1c0f..4afb0c6e25b57f0083d1feb4532b54cbb2b612ec 100644 (file)
@@ -18,6 +18,7 @@
 #include <dirent.h>
 #include <lttng/align.h>
 #include <helper.h>
+#include <limits.h>
 
 struct shm_object_table *shm_object_table_create(size_t max_nb_obj)
 {
@@ -211,10 +212,12 @@ void shmp_object_destroy(struct shm_object *obj)
                        assert(0);
                }
        }
-       ret = close(obj->shm_fd);
-       if (ret) {
-               PERROR("close");
-               assert(0);
+       if (obj->shm_fd >= 0) {
+               ret = close(obj->shm_fd);
+               if (ret) {
+                       PERROR("close");
+                       assert(0);
+               }
        }
        for (i = 0; i < 2; i++) {
                if (obj->wait_fd[i] < 0)
This page took 0.025031 seconds and 4 git commands to generate.