main: Mark end of array with NULL in order not to crash
[platform/upstream/connman.git] / src / rfkill.c
index 17592da..3fdca2f 100644 (file)
@@ -23,6 +23,7 @@
 #include <config.h>
 #endif
 
+#define _GNU_SOURCE
 #include <stdio.h>
 #include <errno.h>
 #include <fcntl.h>
@@ -172,7 +173,7 @@ int __connman_rfkill_block(enum connman_service_type type, connman_bool_t block)
        if (rfkill_type == NUM_RFKILL_TYPES)
                return -EINVAL;
 
-       fd = open("/dev/rfkill", O_RDWR);
+       fd = open("/dev/rfkill", O_RDWR | O_CLOEXEC);
        if (fd < 0)
                return fd;
 
@@ -197,7 +198,7 @@ int __connman_rfkill_init(void)
 
        DBG("");
 
-       fd = open("/dev/rfkill", O_RDWR);
+       fd = open("/dev/rfkill", O_RDWR | O_CLOEXEC);
        if (fd < 0) {
                connman_error("Failed to open RFKILL control device");
                return -EIO;