snprintf(buf, sizeof(buf), "/sys/class/net/%s/address", if_name);
pf = fopen(buf, "r");
if (NULL != pf) {
- fgets(buf, 31, pf);
- WMESH_LOGD("Interface[%s] address[%s]", if_name, buf);
-
- if (strlen(buf) > 0)
- result = g_strdup(buf);
+ if (!fgets(buf, 31, pf) || ferror(pf) || feof(pf)) {
+ WMESH_LOGE("Error open Inerface[%s]", if_name);
+ } else {
+ WMESH_LOGD("Interface[%s] address[%s]", if_name, buf);
+ if (strlen(buf) > 0)
+ result = g_strdup(buf);
+ }
fclose(pf);
}
#if 0
_get_mpath_info(service);
#endif
- _get_station_info(service);
+ ret = _get_station_info(service);
+ if (WMESHD_ERROR_NONE != ret) {
+ WMESH_LOGW("Erro in get station info (%d)", ret);
+ }
}
}
*security = 0;
- while (NULL != fgets(buf, sizeof(buf), fp)) {
+ while (1) {
+ if (!fgets(buf, sizeof(buf), fp) || ferror(fp) || feof(fp))
+ break;
+
if (strncmp(buf, "interface", strlen("interface")) == 0) {
*softap_interface = g_strdup(strrchr(buf, '=') + 1);
WMESH_LOGD("Interface: %s", *softap_interface);
/* LCOV_EXCL_STOP */
} else {
/* Reap child */
- waitpid(pid, &status, 0);
+ if (-1 == waitpid(pid, &status, 0)) {
+ if (errno != EINTR) {
+ WMESH_LOGE(" Faild to reap child [%d] errono(%d)", pid, errno);
+ return WMESHD_ERROR_OPERATION_FAILED;
+ }
+ }
WMESH_LOGD(" child [%d] reaped with status(%d)", pid, status);
}