diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2011-04-10 19:00:04 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2011-04-12 09:54:56 +0200 |
commit | 9faae796bec41daa79b9f7227eade0d9c5ff1260 (patch) | |
tree | 19f9799f7d3dff82ab9cf0331d08d629ac6fc056 /commands/cp.c | |
parent | 583fe4fc0e2651532cb9d56d9c012c86a539250c (diff) | |
download | barebox-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/cp.c')
-rw-r--r-- | commands/cp.c | 3 |
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; |