From 48e94a274ccbfdb1b45b007d85dd32722fe1e4ac Mon Sep 17 00:00:00 2001 From: Dmitry Bogatov Date: Mon, 19 Aug 2013 09:16:23 +0400 Subject: [PATCH] [IMPROVE] move modules removing to terminate function --- daemon/buffer.c | 12 ------------ daemon/main.c | 10 ++++++++++ 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/daemon/buffer.c b/daemon/buffer.c index f9271c3..2c988e3 100644 --- a/daemon/buffer.c +++ b/daemon/buffer.c @@ -68,15 +68,6 @@ static int insert_buf_modules(void) return 0; } -static void remove_buf_modules(void) -{ - LOGI("rmmod buffer start\n"); - if (system("cd /opt/swap/sdk && ./stop.sh")) { - LOGW("Cannot remove swap modules\n"); - } - LOGI("rmmod buffer done\n"); -} - int init_buf(void) { struct buffer_initialize init = { @@ -91,7 +82,6 @@ int init_buf(void) if (open_buf() != 0) { LOGE("Cannot open buffer\n"); - remove_buf_modules(); return 1; } @@ -110,7 +100,6 @@ void exit_buf(void) LOGW("Cannot uninit buffer: %s\n", strerror(errno)); close_buf(); - remove_buf_modules(); } void flush_buf(void) @@ -127,4 +116,3 @@ int write_to_buf(struct msg_data_t *msg) } return 0; } - diff --git a/daemon/main.c b/daemon/main.c index a0d44f3..d26b713 100644 --- a/daemon/main.c +++ b/daemon/main.c @@ -349,10 +349,20 @@ static int finalizeManager() return 0; } +static void remove_buf_modules(void) +{ + LOGI("rmmod buffer start\n"); + if (system("cd /opt/swap/sdk && ./stop.sh")) { + LOGW("Cannot remove swap modules\n"); + } + LOGI("rmmod buffer done\n"); +} + static void terminate(int sig) { _unlink_files(); _close_server_socket(); + remove_buf_modules(); if (sig != 0) { LOGW("Terminating due signal %s\n", strsignal(sig)); signal(sig, SIG_DFL); -- 2.7.4