snprintf(proc_file, 512, "/proc/%d/cmdline", pid);
fd = open(proc_file, O_RDONLY);
- if (fd > 0) {
+ if (fd < 0) { /* failure */
+ ALARM_MGR_EXCEPTION_PRINT("Caution!! app_pid(%d) seems to be "
+ "killed, so we failed to get proc file(%s) and do not create "
+ "alarm_info\n", pid, proc_file);
+ *error_code = -1; /*-1 means that system failed
+ internally.*/
+ free(__alarm_info);
+ return false;
+ } else {
ret = read(fd, process_name, 512);
close(fd);
if (ret <=0)
}
__alarm_info->quark_app_unique_name =
g_quark_from_string(app_name);
- } else { /* failure */
- ALARM_MGR_EXCEPTION_PRINT("Caution!! app_pid(%d) seems to be "
- "killed, so we failed to get proc file(%s) and do not create "
- "alarm_info\n", pid, proc_file);
- *error_code = -1; /*-1 means that system failed
- internally.*/
- free(__alarm_info);
- return false;
}
__alarm_info->quark_bundle=g_quark_from_string(bundle_data);
int ret;
int i = 0;
fd = open(proc_file, O_RDONLY);
- if (fd > 0) {
+ if (fd < 0) { /* failure */
+ __alarm_info->quark_app_unique_name =
+ g_quark_from_string("unknown");
+ ALARM_MGR_EXCEPTION_PRINT("Caution!! app_pid(%d) seems to be "
+ "killed, so we failed to get proc file(%s) and do not create "
+ "alarm_info\n", pid, proc_file);
+ *error_code = -1; /*-1 means that system failed
+ internally.*/
+ free(__alarm_info);
+ return false;
+ } else {
ret = read(fd, process_name, 512);
close(fd);
while (process_name[i] != '\0') {
}
__alarm_info->quark_app_unique_name =
g_quark_from_string(app_name);
- } else { /* failure */
-
- __alarm_info->quark_app_unique_name =
- g_quark_from_string("unknown");
- ALARM_MGR_EXCEPTION_PRINT("Caution!! app_pid(%d) seems to be "
- "killed, so we failed to get proc file(%s) and do not create "
- "alarm_info\n", pid, proc_file);
- *error_code = -1; /*-1 means that system failed
- internally.*/
- free(__alarm_info);
- return false;
}
__alarm_info->quark_app_service_name =
#ifdef __ALARM_BOOT
time_t min_time = 0;
time_t current_time = 0;
- struct tm *temp_info = NULL;
struct rtc_time rtc_tm = { 0, };
struct tm min_time_r = { 0, };
int fd = 0;
if (min_time <= current_time)
min_time = current_time + 5;
- temp_info = gmtime_r(&min_time, &min_time_r);
+ gmtime_r(&min_time, &min_time_r);
ALARM_MGR_LOG_PRINT("__alarm_power_on : %d %d %d %d "
"%d\n", \
ALARM_MGR_ASSERT_PRINT("[alarm-server]:Malloc failed!Can't notify alarm expiry info\n");
goto done;
}
- bzero(expire_info, sizeof (expire_info));
+ memset(expire_info, '\0', MAX_SERVICE_NAME_LEN);
strncpy(expire_info->service_name,
destination_app_service_name,
MAX_SERVICE_NAME_LEN-1);
int ret;
int i = 0;
fd = open(proc_file, O_RDONLY);
- if (fd > 0) {
+ if (fd < 0) { /* failure */
+ quark_app_unique_name = g_quark_from_string("unknown");
+ memcpy(app_name, "unknown", strlen("unknown") + 1);
+
+ ALARM_MGR_EXCEPTION_PRINT("Caution!! app_pid(%d) seems to be "
+ "killed, so we failed to get proc file(%s) \n",
+ pid, proc_file);
+ *return_code = -1; /* -1 means that system
+ failed internally. */
+ return true;
+ } else {
ret = read(fd, process_name, 512);
close(fd);
while (process_name[i] != '\0') {
word = strtok_r(NULL, "/", &proc_name_ptr);
}
quark_app_unique_name = g_quark_from_string(app_name);
- } else { /* failure */
-
- quark_app_unique_name = g_quark_from_string("unknown");
- memcpy(app_name, "unknown", strlen("unknown") + 1);
-
- ALARM_MGR_EXCEPTION_PRINT("Caution!! app_pid(%d) seems to be "
- "killed, so we failed to get proc file(%s) \n",
- pid, proc_file);
- *return_code = -1; /* -1 means that system
- failed internally. */
- return true;
}
ALARM_MGR_LOG_PRINT("called for app(pid:%d, name=%s)\n",
snprintf(proc_file, 256, "/proc/%d/cmdline", pid);
fd = open(proc_file, O_RDONLY);
- if (fd > 0) {
+ if (fd < 0) { /* failure */
+ quark_app_unique_name = g_quark_from_string("unknown");
+ memcpy(app_name, "unknown", strlen("unknown") + 1);
+
+ ALARM_MGR_EXCEPTION_PRINT("Caution!! app_pid(%d) seems to be "
+ "killed, so we failed to get proc file(%s)\n", pid, proc_file);
+ *return_code = -1;
+ /* -1 means that system failed internally. */
+ return true;
+ } else {
ret = read(fd, process_name, 512);
close(fd);
while (process_name[i] != '\0') {
word = strtok_r(NULL, "/", &proc_name_ptr);
}
quark_app_unique_name = g_quark_from_string(app_name);
- } else { /* failure */
-
- quark_app_unique_name = g_quark_from_string("unknown");
- memcpy(app_name, "unknown", strlen("unknown") + 1);
-
- ALARM_MGR_EXCEPTION_PRINT("Caution!! app_pid(%d) seems to be "
- "killed, so we failed to get proc file(%s)\n", pid, proc_file);
- *return_code = -1;
- /* -1 means that system failed internally. */
- return true;
}
ALARM_MGR_LOG_PRINT("called for app(pid:%d, name=%s)\n",