X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;ds=sidebyside;f=ls-files.c;h=6af3b091b049d8ded1999405b4da7191f2b36a4c;hb=af3feefa1d057713c2277cc1543d438e60c65306;hp=cc5b32e8bac12105873ecee73a9fc9036d71b61b;hpb=657907e76e298cac31845dadda2c71b431d9e712;p=git.git diff --git a/ls-files.c b/ls-files.c index cc5b32e8..6af3b091 100644 --- a/ls-files.c +++ b/ls-files.c @@ -209,7 +209,7 @@ static int excluded(const char *pathname) struct nond_on_fs { int len; - char name[0]; + char name[FLEX_ARRAY]; /* more */ }; static struct nond_on_fs **dir; @@ -293,11 +293,12 @@ static void read_directory(const char *path, const char *base, int baselen) /* fallthrough */ case DT_DIR: memcpy(fullname + baselen + len, "/", 2); + len++; if (show_other_directories && - !dir_exists(fullname, baselen + len + 1)) + !dir_exists(fullname, baselen + len)) break; read_directory(fullname, fullname, - baselen + len + 1); + baselen + len); continue; case DT_REG: case DT_LNK: