You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by ma...@apache.org on 2015/12/03 19:26:26 UTC
incubator-mynewt-larva git commit: Make sure directory name ends in
'/' before trying to inspect files within that directory.
Repository: incubator-mynewt-larva
Updated Branches:
refs/heads/master 6a4288c93 -> 3de06a111
Make sure directory name ends in '/' before trying to inspect
files within that directory.
Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/commit/3de06a11
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/tree/3de06a11
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/diff/3de06a11
Branch: refs/heads/master
Commit: 3de06a1115deba319fbd98ca7bf948a0e9016a6c
Parents: 6a4288c
Author: Marko Kiiskila <ma...@runtime.io>
Authored: Thu Dec 3 10:24:26 2015 -0800
Committer: Marko Kiiskila <ma...@runtime.io>
Committed: Thu Dec 3 10:24:26 2015 -0800
----------------------------------------------------------------------
libs/fs/src/fs_cli.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/blob/3de06a11/libs/fs/src/fs_cli.c
----------------------------------------------------------------------
diff --git a/libs/fs/src/fs_cli.c b/libs/fs/src/fs_cli.c
index d6cc182..45bdbf2 100644
--- a/libs/fs/src/fs_cli.c
+++ b/libs/fs/src/fs_cli.c
@@ -65,7 +65,6 @@ fs_ls_cmd(int argc, char **argv)
return 1;
}
- plen = strlen(path);
rc = fs_open(path, FS_ACCESS_READ, &file);
if (rc == 0) {
fs_ls_file(path, file);
@@ -74,7 +73,13 @@ fs_ls_cmd(int argc, char **argv)
goto done;
}
- strncpy(name, path, sizeof(name) - 1);
+ plen = strlen(path);
+ strncpy(name, path, sizeof(name) - 2);
+ if (name[plen - 1] != '/') {
+ name[plen++] = '/';
+ name[plen] = '\0';
+ }
+
rc = fs_opendir(path, &dir);
if (rc == 0) {
do {