void _util_conv_wstr_to_guid(mtp_wchar *wstr, mtp_uint64 *guid);
mtp_bool _util_get_unique_dir_path(const mtp_char *exist_path, mtp_char *new_path,
mtp_uint32 new_path_buf_len);
+mtp_int32 _util_system_cmd_wait(const mtp_char *cmd);
#endif /* _MTP_SUPPORT_H_ */
Name: mtp-responder
Summary: Media Transfer Protocol daemon (responder)
-Version: 0.0.22
+Version: 0.0.24
Release: 1
Group: Network & Connectivity/Other
License: Apache-2.0
if (_util_is_file_opened(child_obj->file_path) == TRUE) {
ERR_SECURE("File [%s] is already opened\n",
child_obj->file_path);
+ _prop_deinit_ptparray(&child_arr);
return FALSE;
}
inter_path, minutes,
MTP_FILES_MODIFIED_FILES);
DBG("find query is [%s]\n", command);
- ret = system(command);
+ ret = _util_system_cmd_wait(command);
+
if (WIFSIGNALED(ret) &&
(WTERMSIG(ret) == SIGINT ||
WTERMSIG(ret) == SIGQUIT)) {
ext_path, minutes,
MTP_FILES_MODIFIED_FILES);
DBG("find query is [%s]\n", command);
- ret = system(command);
+ ret = _util_system_cmd_wait(command);
+
if (WIFSIGNALED(ret) &&
(WTERMSIG(ret) == SIGINT ||
WTERMSIG(ret) == SIGQUIT)) {
sizeof(msgq_ptr_t) - sizeof(long), 0)) {
ERR("_util_msgq_send() Fail");
}
+ g_free(pkt.buffer);
res = _util_thread_join(g_data_rcv, &th_result);
if (res == FALSE)
#include <glib.h>
#include <glib/gprintf.h>
#include <unistd.h>
+#include <sys/wait.h>
#include "mtp_support.h"
#include "ptp_datacodes.h"
#include "mtp_util.h"
DBG_SECURE("Unique dir name[%s]\n", new_path);
return TRUE;
}
+
+mtp_int32 _util_system_cmd_wait(const mtp_char *cmd)
+{
+
+ int pid = 0;
+ int status = 0;
+
+ if (cmd == NULL)
+ return -1;
+
+ pid = fork();
+
+ if (pid == -1)
+ return -1;
+
+ if (pid == 0) {
+ char *argv[4];
+ argv[0] = "sh";
+ argv[1] = "-c";
+ argv[2] = (char*)cmd;
+ argv[3] = 0;
+ execv("/bin/sh", argv);
+ exit(127);
+ }
+
+ do {
+ if (waitpid(pid, &status, 0) == -1) {
+ if (errno != EINTR)
+ return -1;
+ } else {
+ return status;
+ }
+ } while(1);
+}
+