From: Andre Noll Date: Mon, 31 Aug 2015 20:00:17 +0000 (+0200) Subject: com_rm(): In force mode, don't complain if no paths matched. X-Git-Tag: v0.5.6~94^2~1 X-Git-Url: http://git.tue.mpg.de/?a=commitdiff_plain;h=c27a8644af6d285ca6bfd39be9b923ef9f911f78;p=paraslash.git com_rm(): In force mode, don't complain if no paths matched. The documentation says that the rm command stays silent and exits successfully if none of the given patterns matched any path of the audio file table. This was true until commit b02b7155 (com_rm(): Return negative on errors), which effectively made -f a no-op by mistake. Since then the rm command prints an error message and fails if there is no match. This patch restores the documented behaviour. --- diff --git a/aft.c b/aft.c index bfa4ce1a..a5da1a92 100644 --- a/aft.c +++ b/aft.c @@ -2150,9 +2150,10 @@ static int com_rm_callback(struct afs_callback_arg *aca) ret = for_each_matching_row(&pmd); if (ret < 0) goto out; - if (pmd.num_matches == 0) - ret = -E_NO_MATCH; - else if (flags & RM_FLAG_VERBOSE) + if (pmd.num_matches == 0) { + if (!(flags & RM_FLAG_FORCE)) + ret = -E_NO_MATCH; + } else if (flags & RM_FLAG_VERBOSE) para_printf(&aca->pbout, "removed %u file(s)\n", pmd.num_matches); out: