return -1;
}
- sprintf(command, "%s", exec_path);
- LOGI("cmd: %s\n", command);
+ snprintf(command, sizeof(command), "%s", exec_path);
+ LOGI("cmd: <%s>\n", command);
pid = fork();
if (pid == -1)
} else
LOGI("cannot kill <%s>; process not found\n", binary_path);
+ LOGI("kill< %s (%d)\n", binary_path, FINISH_SIG);
return 0;
}
fclose(fp);
return uptime;
}
+
+void swap_usleep(useconds_t usec)
+{
+ struct timespec req;
+ struct timespec rem;
+ req.tv_sec = usec / 1000000;
+ req.tv_nsec = (usec % 1000000) * 1000;
+ if (nanosleep(&req, &rem) == -1) {
+ LOGW("sleep was terminated by signal\n");
+ }
+}
if (ret)
goto fail;
- sprintf(info_tmp, "0x%lx", INSPECTOR_ADDR);
+ snprintf(info_tmp, sizeof(info_tmp), "0x%lx", INSPECTOR_ADDR);
ret = set_profile_info(INSPSERVER_START_FILE, info_tmp);
if (ret)
goto fail;
- sprintf(info_tmp, "0x%lx", WILLEXECUTE_ADDR);
+ snprintf(info_tmp, sizeof(info_tmp), "0x%lx", WILLEXECUTE_ADDR);
ret = set_profile_info(WILL_EXECUTE_FILE, info_tmp);
if (ret)
goto fail;
- sprintf(info_tmp, "0x%lx", DIDEXECUTE_ADDR);
+ snprintf(info_tmp, sizeof(info_tmp), "0x%lx", DIDEXECUTE_ADDR);
ret = set_profile_info(DID_EXECUTE_FILE, info_tmp);
if (ret)
goto fail;
int ret = 0;
char *app_id;
char *package_id;
+ char *tmp_ch;
size_t id_maxlen = 128;
app_id = strndup(app_info->app_id, id_maxlen);
goto exit;
}
- package_id = strtok(app_id, delim);
+ /* TODO do not use strok_r function there */
+ package_id = strtok_r(app_id, delim, &tmp_ch);
if (package_id != NULL) {
ret = apply_smack_rules(SUBJECT, package_id, ACCESS_TYPE);
const char *page = "/devtools/page/1";
int ietf_version = -1; /* latest */
- sprintf(host, "%s:%d", address, port);
- sprintf(origin, "http://%s:%d", address, port);
+ snprintf(host, sizeof(host), "%s:%d", address, port);
+ snprintf(origin, sizeof(origin), "http://%s:%d", address, port);
LOGI(" host =<%s> origin = <%s>\n", host, origin);
memset(&info, 0, sizeof(info));