diff --git a/src/gufi_query/main.c b/src/gufi_query/main.c index a8c13ec42..09b0f1d58 100644 --- a/src/gufi_query/main.c +++ b/src/gufi_query/main.c @@ -666,17 +666,16 @@ int main(int argc, char *argv[]) return -1; } - /* enqueue all input paths */ + /* enqueue input paths */ for(int i = idx; i < argc; i++) { - /* remove trailing slashes */ - size_t len = trailing_non_match_index(argv[i], strlen(argv[i]), "/", 1); - - /* root is special case */ - if (len == 0) { - argv[i][0] = '/'; - len = 1; + size_t len = strlen(argv[i]); + if (!len) { + continue; } + /* remove trailing slashes */ + len = trailing_non_match_index(argv[i] + 1, strlen(argv[i] + 1), "/", 1) + 1; + struct stat st; if (lstat(argv[i], &st) != 0) { fprintf(stderr, "Could not stat directory \"%s\"\n", argv[i]); diff --git a/src/gufi_unrollup.c b/src/gufi_unrollup.c index 136752fd2..2b76ff43a 100644 --- a/src/gufi_unrollup.c +++ b/src/gufi_unrollup.c @@ -275,17 +275,16 @@ int main(int argc, char *argv[]) { return -1; } - /* enqueue all input paths */ + /* enqueue input paths */ for(int i = idx; i < argc; i++) { - /* remove trailing slashes */ - size_t len = trailing_non_match_index(argv[i], strlen(argv[i]), "/", 1); - - /* root is special case */ - if (len == 0) { - argv[i][0] = '/'; - len = 1; + size_t len = strlen(argv[i]); + if (!len) { + continue; } + /* remove trailing slashes */ + len = trailing_non_match_index(argv[i] + 1, strlen(argv[i] + 1), "/", 1) + 1; + struct Unrollup *mywork = malloc(sizeof(struct Unrollup)); /* copy argv[i] into the work item */