technology: return already enabled when tethering is enabled
[framework/connectivity/connman.git] / src / rfkill.c
index 17592da..77c5b92 100644 (file)
@@ -2,7 +2,7 @@
  *
  *  Connection Manager
  *
- *  Copyright (C) 2007-2010  Intel Corporation. All rights reserved.
+ *  Copyright (C) 2007-2012  Intel Corporation. All rights reserved.
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License version 2 as
@@ -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;