Fix dereference after null check
[platform/upstream/connman.git] / src / rfkill.c
index 20908d7..99b337d 100755 (executable)
@@ -23,7 +23,6 @@
 #include <config.h>
 #endif
 
-#define _GNU_SOURCE
 #include <stdio.h>
 #include <errno.h>
 #include <fcntl.h>
@@ -169,7 +168,7 @@ int __connman_rfkill_block(enum connman_service_type type, bool block)
        DBG("type %d block %d", type, block);
 
 #if defined TIZEN_EXT
-       DBG("try to set rfkill block %d, but it's not pormitted", block);
+       DBG("try to set rfkill block %d, but it's not permitted", block);
 
        return 0;
 #else
@@ -206,7 +205,7 @@ int __connman_rfkill_init(void)
 
        DBG("");
 
-       fd = open("/dev/rfkill", O_RDWR | O_CLOEXEC);
+       fd = open("/dev/rfkill", O_RDONLY | O_CLOEXEC);
        if (fd < 0) {
                connman_error("Failed to open RFKILL control device");
                return -EIO;