aboutsummaryrefslogtreecommitdiffstats
path: root/src/command.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/command.c26
1 files changed, 11 insertions, 15 deletions
diff --git a/src/command.c b/src/command.c
index c98bc20e7..1d2645cd1 100644
--- a/src/command.c
+++ b/src/command.c
@@ -803,31 +803,27 @@ static int handlePlaylistMove(struct client *client,
return print_playlist_result(client, result);
}
-static int print_update_result(struct client *client, int ret)
-{
- if (ret >= 0) {
- client_printf(client, "updating_db: %i\n", ret);
- return 0;
- }
- if (ret == -2)
- command_error(client, ACK_ERROR_ARG, "invalid path");
- else
- command_error(client, ACK_ERROR_UPDATE_ALREADY,
- "already updating");
- return -1;
-}
-
static int handleUpdate(struct client *client,
mpd_unused int argc, char *argv[])
{
char *path = NULL;
+ int ret;
assert(argc <= 2);
if (argc == 2 && !(path = sanitizePathDup(argv[1]))) {
command_error(client, ACK_ERROR_ARG, "invalid path");
return -1;
}
- return print_update_result(client, directory_update_init(path));
+
+ ret = directory_update_init(path);
+ if (ret > 0) {
+ client_printf(client, "updating_db: %i\n", ret);
+ return 0;
+ } else {
+ command_error(client, ACK_ERROR_UPDATE_ALREADY,
+ "already updating");
+ return -1;
+ }
}
static int handleNext(mpd_unused struct client *client,