summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2002-11-17 09:41:34 +0000
committerJim Meyering <jim@meyering.net>2002-11-17 09:41:34 +0000
commit47161ee7d5ab4fe8977bcb2fb24d0b708b83ec27 (patch)
treed28835f40e913f2185b1ee07fc4b4dcadea325fe /src
parentf5c148c983b39620fd1f1666fee97262ad127bed (diff)
downloadcoreutils-47161ee7d5ab4fe8977bcb2fb24d0b708b83ec27.tar.xz
(movefile): Don't remove trailing slashes from SOURCE.
Diffstat (limited to 'src')
-rw-r--r--src/mv.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/mv.c b/src/mv.c
index 77fb9ff9e..8c6f3b5ee 100644
--- a/src/mv.c
+++ b/src/mv.c
@@ -284,14 +284,11 @@ movefile (char *source, char *dest, int dest_is_dir,
if (dest_is_dir || (dest_had_trailing_slash && !is_real_dir (source)))
{
/* DEST is a directory; build full target filename. */
- char *src_basename;
- char *new_dest;
-
- strip_trailing_slashes (source);
- src_basename = base_name (source);
- new_dest = path_concat (dest, src_basename, NULL);
+ char const *src_basename = base_name (source);
+ char *new_dest = path_concat (dest, src_basename, NULL);
if (new_dest == NULL)
xalloc_die ();
+ strip_trailing_slashes (new_dest);
fail = do_move (source, new_dest, x);
free (new_dest);
}