Add Signal Handling for Module State Changed
[platform/core/connectivity/net-config.git] / src / network-monitor.c
index bce7bfe..4d9b85c 100755 (executable)
@@ -45,9 +45,9 @@ int netconfig_ethernet_cable_plugin_status_check()
        int ret = -1;
        FILE *fd = NULL;
        char error_buf[MAX_SIZE_ERROR_BUFFER] = {0, };
-       if(0 == access(ETHERNET_CABLE_STATUS, F_OK)) {
+       if (0 == access(ETHERNET_CABLE_STATUS, F_OK)) {
                fd = fopen(ETHERNET_CABLE_STATUS, "r");
-               if(fd == NULL) {
+               if (fd == NULL) {
                        ERR("Error! Could not open /sys/class/net/eth0/carrier file\n");
                        return -1;
                }
@@ -59,21 +59,21 @@ int netconfig_ethernet_cable_plugin_status_check()
        int rv = 0;
        errno = 0;
        rv = fscanf(fd, "%d", &ret);
-       if(rv < 0) {
-               strerror_r(errno, error_buf, MAX_SIZE_ERROR_BUFFER);
-               ERR("Error! Failed to read from file, rv:[%d], error:[%s]", rv, error_buf);
+       if (rv < 0) {
+               ERR("Error! Failed to read from file, rv:[%d], error:[%s]",
+                               rv, strerror_r(errno, error_buf, MAX_SIZE_ERROR_BUFFER));
                fclose(fd);
                return -1;
        }
 
-       if(ret == 1) {
-               if(!g_chk_eth_send_notification) {
+       if (ret == 1) {
+               if (!g_chk_eth_send_notification) {
                        ERR("/sys/class/net/eth0/carrier : [%d]", ret);
                        netconfig_network_notify_ethernet_cable_state("ATTACHED");
                }
                g_chk_eth_send_notification = TRUE;
        } else if (ret == 0) {
-               if(g_chk_eth_send_notification) {
+               if (g_chk_eth_send_notification) {
                        ERR("/sys/class/net/eth0/carrier : [%d]", ret);
                        netconfig_network_notify_ethernet_cable_state("DETACHED");
                }