In copy-out mode, when appending, change_dir() would be called twice,
because process_copy_in() calls change_dir(). If --directory=DIR was
used with a relative path, this would result in incorrectly trying to
change to DIR/DIR. To fix this, change_dir() is only called
explicitly when not appending.
---
src/copyout.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/copyout.c b/src/copyout.c
index ca6798c..e3c93fb 100644
--- a/src/copyout.c
+++ b/src/copyout.c
@@ -627,13 +627,13 @@ process_copy_out (void)
output_is_seekable = S_ISREG (file_stat.st_mode);
}
- change_dir ();
-
if (append_flag)
{
process_copy_in ();
prepare_append (out_file_des);
}
+ else
+ change_dir ();
/* Copy files with names read from stdin. */
while (ds_fgetstr (stdin, &input_name, name_end) != NULL)
--
2.33.0