From 887f97b868886a66d7bb2fcd0e1fd6810297299d Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sun, 28 Sep 2008 20:29:40 -0700 Subject: clean up updateInit calling and error handling Move error reporting to command.c so directory.c does not deal with client error handling any more. --- src/directory.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'src/directory.c') diff --git a/src/directory.c b/src/directory.c index 124ea194e..a332316ff 100644 --- a/src/directory.c +++ b/src/directory.c @@ -18,7 +18,6 @@ #include "directory.h" -#include "command.h" #include "conf.h" #include "log.h" #include "ls.h" @@ -148,14 +147,13 @@ out: return (void *)ret; } -int updateInit(int fd, List * path_list) +int updateInit(List * path_list) { pthread_attr_t attr; - if (progress != UPDATE_PROGRESS_IDLE) { - commandError(fd, ACK_ERROR_UPDATE_ALREADY, "already updating"); + if (progress != UPDATE_PROGRESS_IDLE) return -1; - } + progress = UPDATE_PROGRESS_RUNNING; pthread_attr_init(&attr); @@ -166,9 +164,7 @@ int updateInit(int fd, List * path_list) directory_updateJobId = 1; DEBUG("updateInit: spawned update thread for update job id %i\n", (int)directory_updateJobId); - fdprintf(fd, "updating_db: %i\n", (int)directory_updateJobId); - - return 0; + return directory_updateJobId; } static void directory_set_stat(Directory * dir, const struct stat *st) -- cgit v1.2.3