diff --git a/builtin/mv.c b/builtin/mv.c
index 4a8374f63d8a55593309a42967a740201de6a62a..2a144b011caa8ecb70f55976bdec60cae89fad9e 100644 (file)
--- a/builtin/mv.c
+++ b/builtin/mv.c
to_copy--;
if (to_copy != length || base_name) {
char *it = xmemdupz(result[i], to_copy);
- result[i] = base_name ? strdup(basename(it)) : it;
+ if (base_name) {
+ result[i] = xstrdup(basename(it));
+ free(it);
+ } else
+ result[i] = it;
}
}
return get_pathspec(prefix, result);
* check both source and destination
*/
if (S_ISREG(st.st_mode) || S_ISLNK(st.st_mode)) {
- warning(_("overwriting '%s'"), dst);
+ if (verbose)
+ warning(_("overwriting '%s'"), dst);
bad = NULL;
} else
bad = _("Cannot overwrite");