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;
}
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");
}