Re: [PATCH 1/4] is_directory(): a generic helper function
- From
Johannes Sixt <j.sixt@viscovery.net>
- Date
- Sep 9, 2008, 10:31 UTC
- Message-ID
- <48C6508B.1080600@viscovery.net>
- In-Reply-To
- <1220948830-3275-2-git-send-email-gitster@pobox.com>
Junio C Hamano schrieb:
> +/* > + * Do not use this for inspecting *tracked* content. When path is a > + * symlink to a directory, we do not want to say it is a directory.
I though stat(2) checks the thing that a symlink points to. Then either this comment is not correct or you want to use lstat(2), no?
Show 7 quoted lines
> + * Worth yet, leading components in path could contain symbolic links.
> + */
> +int is_directory(const char *path)
> +{
> + struct stat st;
> + return (!stat(path, &st) && S_ISDIR(st.st_mode));
> +}-- Hannes