summaryrefslogtreecommitdiffstats
path: root/commands
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2011-04-10 19:00:04 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2011-04-12 09:54:56 +0200
commit9faae796bec41daa79b9f7227eade0d9c5ff1260 (patch)
tree19f9799f7d3dff82ab9cf0331d08d629ac6fc056 /commands
parent583fe4fc0e2651532cb9d56d9c012c86a539250c (diff)
downloadbarebox-9faae796bec41daa79b9f7227eade0d9c5ff1260.tar.gz
barebox-9faae796bec41daa79b9f7227eade0d9c5ff1260.tar.xz
cp command: handle directories as last argument
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'commands')
-rw-r--r--commands/cp.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/commands/cp.c b/commands/cp.c
index ae8719b24b..342810528b 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;