diff options
-rw-r--r-- | src/command.c | 8 | ||||
-rw-r--r-- | src/database.c | 2 | ||||
-rw-r--r-- | src/update.c | 4 | ||||
-rw-r--r-- | src/update.h | 4 |
4 files changed, 8 insertions, 10 deletions
diff --git a/src/command.c b/src/command.c index aafb88418..541a71a50 100644 --- a/src/command.c +++ b/src/command.c @@ -788,14 +788,12 @@ static int handlePlaylistMove(int fd, mpd_unused int *permission, static int print_update_result(int fd, int ret) { - if (ret >= 0) { + if (ret > 0) { fdprintf(fd, "updating_db: %i\n", ret); return 0; } - if (ret == -2) - commandError(fd, ACK_ERROR_ARG, "invalid path"); - else - commandError(fd, ACK_ERROR_UPDATE_ALREADY, "already updating"); + assert(!ret); + commandError(fd, ACK_ERROR_UPDATE_ALREADY, "already updating"); return -1; } diff --git a/src/database.c b/src/database.c index 3a1667bb6..ea78940f8 100644 --- a/src/database.c +++ b/src/database.c @@ -40,7 +40,7 @@ void db_init(void) { music_root = directory_new("", NULL); - if (directory_update_init(NULL) < 0) + if (!directory_update_init(NULL)) FATAL("directory update failed\n"); do { diff --git a/src/update.c b/src/update.c index f5619a1d4..7dc50b5aa 100644 --- a/src/update.c +++ b/src/update.c @@ -418,9 +418,9 @@ int directory_update_init(char *path) int next_task_id; if (!path) - return -1; + return 0; if (update_paths_nr == ARRAY_SIZE(update_paths)) - return -1; + return 0; assert(update_paths_nr < ARRAY_SIZE(update_paths)); update_paths[update_paths_nr++] = path; next_task_id = update_task_id + update_paths_nr; diff --git a/src/update.h b/src/update.h index 0c0d74416..5c7277e32 100644 --- a/src/update.h +++ b/src/update.h @@ -23,8 +23,8 @@ int isUpdatingDB(void); /* - * returns the non-negative update job ID on success, - * returns -1 if busy + * returns the positive update job ID on success, + * returns 0 if busy * @path will be freed by this function and should not be reused */ int directory_update_init(char *path); |