From: Andreas Henriksson Date: Mon, 22 Jun 2015 17:26:22 +0000 (+0200) Subject: rename: allow full-path renames X-Git-Tag: v2.27-rc1~129 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9fa6088aa9b279f3f4de3df0eb8eb9cbcda7f09e;p=thirdparty%2Futil-linux.git rename: allow full-path renames The command "touch b0;rename.ul -v ./b0 ./b1 ./b0" used to work before "allow renaming in subdirectories" change. (regression in commit bd9ced628bb86) Addresses: https://bugs.debian.org/789240 Reported-by: gregrwm Reviewed-by: Sami Kerola Signed-off-by: Andreas Henriksson --- diff --git a/misc-utils/rename.c b/misc-utils/rename.c index 7ac068d639..c8a4f8ca57 100644 --- a/misc-utils/rename.c +++ b/misc-utils/rename.c @@ -92,10 +92,11 @@ static int do_symlink(char *from, char *to, char *s, int verbose) static int do_file(char *from, char *to, char *s, int verbose) { - char *newname = NULL, *file; + char *newname = NULL, *file=NULL; int ret = 1; - file = strrchr(s, '/'); + if (strchr(from, '/') == NULL && strchr(to, '/') == NULL) + file = strrchr(s, '/'); if (file == NULL) file = s; if (string_replace(from, to, file, s, &newname))