diff options
-rw-r--r-- | rhdropbox.c | 23 |
1 files changed, 8 insertions, 15 deletions
diff --git a/rhdropbox.c b/rhdropbox.c index 83c6d10..bfcf087 100644 --- a/rhdropbox.c +++ b/rhdropbox.c @@ -174,7 +174,7 @@ void send_status_watch_list(int fd, watch_list_t* watch_lst, client_t* client_ls return; } -int process_cmd_add_remove(cmd_id_t cmd_id, const char* path, int fd, int inotify_fd, watch_list_t* watch_lst, client_t* client_lst) +void process_cmd_add_remove(cmd_id_t cmd_id, const char* path, int fd, int inotify_fd, watch_list_t* watch_lst, client_t* client_lst) { int wd = 0; int tmp_fd = watch_list_find_fd(watch_lst, path); @@ -183,7 +183,7 @@ int process_cmd_add_remove(cmd_id_t cmd_id, const char* path, int fd, int inotif wd = inotify_add_watch(inotify_fd, path, IN_CLOSE_WRITE | IN_DELETE_SELF | IN_MOVE_SELF | IN_ONLYDIR); else { log_printf(DEBUG, "cmd_add_remove: path already in watch list"); - return 0; + return; } } else if(cmd_id == REMOVE) { @@ -192,17 +192,17 @@ int process_cmd_add_remove(cmd_id_t cmd_id, const char* path, int fd, int inotif else { log_printf(ERROR, "cmd_add_remove path not found in watch list"); send_response(fd, "Error: path not found in watch list"); - return 0; + return; } } else { log_printf(WARNING, "cmd_add_remove ignoring wrong cmd_id"); - return 0; + return; } if(wd < 0) { log_printf(ERROR, "inotify %s '%s' failed: %s", cmd_id == ADD ? "adding" : "removing", path, strerror(errno)); send_response(fd, "Error: add/remove failed"); - return 0; + return; } int ret = 0; @@ -210,7 +210,7 @@ int process_cmd_add_remove(cmd_id_t cmd_id, const char* path, int fd, int inotif ret = watch_list_add(watch_lst, wd, path); if(ret) { log_printf(ERROR, "can't add path to watch list"); - send_response(fd, "Error: can't add path to wath list"); + send_response(fd, "Error: can't add path to watch list"); } } else { @@ -221,8 +221,6 @@ int process_cmd_add_remove(cmd_id_t cmd_id, const char* path, int fd, int inotif send_status_watch_list(-1, watch_lst, client_lst); log_printf(NOTICE, "inotify %s '%s'", cmd_id == ADD ? "added" : "removed", path); } - - return ret; } void process_cmd_status(int fd, watch_list_t* watch_lst, client_t* client_lst) @@ -311,13 +309,8 @@ int process_cmd(const char* cmd, int fd, int inotify_fd, watch_list_t* watch_lst switch(cmd_id) { case ADD: - case REMOVE: { - int ret = process_cmd_add_remove(cmd_id, param, fd, inotify_fd, watch_lst, client_lst); - if(ret) - return ret; - break; - } - case STATUS: process_cmd_status(fd, watch_lst, client_lst); break; + case REMOVE: process_cmd_add_remove(cmd_id, param, fd, inotify_fd, watch_lst, client_lst); return ret; + case STATUS: process_cmd_status(fd, watch_lst, client_lst); break; case LOG: { if(param && param[0]) log_printf(NOTICE, "ext msg: %s", param); |