[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [patch] glob: resolve DT_UNKNOWN via is_dir
From: |
Florian Weimer |
Subject: |
Re: [patch] glob: resolve DT_UNKNOWN via is_dir |
Date: |
Wed, 17 Nov 2021 12:12:20 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) |
* DJ Delorie:
> diff --git a/lib/glob.c b/lib/glob.c
> index 22c459574..d0521bb4a 100644
> --- a/lib/glob.c
> +++ b/lib/glob.c
> @@ -1381,7 +1381,26 @@ glob_in_dir (const char *pattern, const char
> *directory, int flags,
> if (flags & GLOB_ONLYDIR)
> switch (readdir_result_type (d))
> {
> - case DT_DIR: case DT_LNK: case DT_UNKNOWN: break;
> + case DT_DIR: case DT_LNK: break;
> + case DT_UNKNOWN:
> + {
> + /* The filesystem was too lazy to give us a hint,
> + so we have to do it the hard way. */
> + char *fullpath, *p;
> + bool isdir;
> + fullpath = malloc (strlen (directory) + strlen (d.name) +
> 2);
> + if (fullpath == NULL)
> + /* This matches old behavior wrt DT_UNKNOWN. */
> + break;
Shouldn't this report memory allocation failure to the caller?
Thanks,
Florian