[PATCH 7/7] cp command: handle directories as last argument

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Sascha Hauer <s.hauer@xxxxxxxxxxxxxx>
---
 commands/cp.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/commands/cp.c b/commands/cp.c
index ae8719b..3428105 100644
--- a/commands/cp.c
+++ b/commands/cp.c
@@ -31,6 +31,7 @@
 #include <libbb.h>
 #include <fs.h>
 #include <malloc.h>
+#include <libgen.h>
 
 /**
  * @param[in] cmdtp FIXME
@@ -60,7 +61,7 @@ static int do_cp(struct command *cmdtp, int argc, char *argv[])
 	for (i = 1; i < argc - 1; i++) {
 		if (last_is_dir) {
 			char *dst;
-			dst = concat_path_file(argv[argc - 1], argv[i]);
+			dst = concat_path_file(argv[argc - 1], basename(argv[i]));
 			ret = copy_file(argv[i], dst);
 			if (ret)
 				goto out;
-- 
1.7.2.3


_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox


[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux