#include <errno.h>
#include <sys/wait.h>
#include "stc-manager.h"
-#include "stc-emulator.h"
#include "stc-manager-gdbus.h"
#include "stc-db.h"
#include "counter.h"
#include "stc-manager-plugin-appstatus.h"
#include "stc-manager-plugin-exception.h"
#include "stc-manager-plugin-procfs.h"
+#include "stc-manager-plugin-tether.h"
#define BUF_SIZE_FOR_ERR 100
stc_plugin_appstatus_deinit();
stc_plugin_exception_deinit();
stc_plugin_procfs_deinit();
+ stc_plugin_tether_deinit();
inotify_deregister(INFO_STORAGE_DIR);
inotify_deinitialize();
cgroup_set_release_agent(NET_CLS_SUBSYS, NET_RELEASE_AGENT);
- EXEC(STC_ERROR_NONE, stc_db_initialize());
+ err = stc_db_initialize();
+ if (err != STC_ERROR_NONE) {
+ STC_LOGD("Failed to initialize stc db"); //LCOV_EXCL_LINE
+ return NULL; //LCOV_EXCL_LINE
+ }
stc_plugin_appstatus_init();
stc_plugin_exception_init();
stc_plugin_procfs_init();
+ stc_plugin_tether_init();
stc_firewall_init();
err = stc_monitor_init();
- if (err != STC_ERROR_NONE)
- goto handle_error;
+ if (err != STC_ERROR_NONE) {
+ STC_LOGD("Failed to initialize stc manager"); //LCOV_EXCL_LINE
+ return NULL; //LCOV_EXCL_LINE
+ }
stc_plugin_procfs_load_pid();
stc_manager_gdbus_init((gpointer)stc);
STC_LOGI("stc manager initialized");
__STC_LOG_FUNC_EXIT__;
return stc;
-
-handle_error:
- STC_LOGD("Failed to initialize stc manager"); //LCOV_EXCL_LINE
- __stc_manager_deinit(); //LCOV_EXCL_LINE
- return NULL; //LCOV_EXCL_LINE
}
stc_s *stc_get_manager(void)
if (pid == 0) {
errno = 0;
+
+ if (!g_strcmp0(args[1], STC_CMD_INSERT)) {
+ STC_LOGE("Invalid arguments");
+ g_strfreev(args);
+ exit(-1);
+ }
+
if (execv(args[0], args) == -1) {
- STC_LOGE("Failed to execute [%s]", err_str);
+ STC_LOGE("Failed to execute [%s]", *err_str);
g_strfreev(args);
exit(-1);
}
/* Crate the GLIB main loop */
main_loop = g_main_loop_new(NULL, FALSE);
- stc_emulator_check_environment();
- if (stc_emulator_is_emulated() == FALSE) {
- g_stc = __stc_manager_init();
- if (!g_stc)
- goto fail;
- g_stc->main_loop = main_loop;
- }
+ g_stc = __stc_manager_init();
+ if (!g_stc)
+ goto fail;
+
+ g_stc->main_loop = main_loop;
/* Run the main loop */
g_main_loop_run(main_loop);
ret = 0;
fail:
- if (stc_emulator_is_emulated() == FALSE)
- __stc_manager_deinit();
+ __stc_manager_deinit();
if (main_loop)
g_main_loop_unref(main_loop);