mirror of
https://git.savannah.gnu.org/git/coreutils.git
synced 2026-11-17 18:02:09 +03:00
(movefile): Remove a single trailing slash from destdir before concatenating
with `/' and filename for `ok to overwrite...' message.
This commit is contained in:
1 parent
63c91c859f
commit
7108d098ae
1 file changed
+3
@@ -227,6 +227,9 @@ movefile (source, dest)
|
||||
char *new_dest;
|
||||
|
||||
base = basename (source);
|
||||
/* Remove a (single) trailing slash if there is at least one. */
|
||||
if (dest[strlen (dest) - 1] == '/')
|
||||
dest[strlen (dest) - 1] = '\0';
|
||||
new_dest = (char *) alloca (strlen (dest) + 1 + strlen (base) + 1);
|
||||
stpcpy (stpcpy (stpcpy (new_dest, dest), "/"), base);
|
||||
return do_move (source, new_dest);
|
||||
|
||||
Reference in new issue
Block a user