From 1d59716731f3ed8569d60ae84c291bd93eb7d582 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Thu, 9 Oct 2008 19:17:44 +0200 Subject: update: job ID must be positive The documentation for directory_update_init() was incorrect: a job ID must be positive, not non-negative. If the update queue is full and no job was created, it makes more sense to return 0 instead of -1, because it is more consistent with the return value of isUpdatingDB(). --- src/command.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'src/command.c') 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; } -- cgit v1.2.3