Re: [PATCH] portability: allow building in systems without d_type

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Carlo,

Carlo Marcelo Arenas Belón <carenas@xxxxxxxxx> writes:

> Since 09fb155f11 (diff --no-index: support limiting by pathspec,
> 2025-05-21) will fail to build in platforms that don't have a
> d_type member on their struct dirent (ex: AIX, NonStop).
>
> Use the DTYPE() macro instead of a nake reference to d_type.
>
> Signed-off-by: Carlo Marcelo Arenas Belón <carenas@xxxxxxxxx>
> ---
>  diff-no-index.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/diff-no-index.c b/diff-no-index.c
> index 4aeeb98cfa..7c95222ba6 100644
> --- a/diff-no-index.c
> +++ b/diff-no-index.c
> @@ -46,7 +46,7 @@ static int read_directory_contents(const char *path, struct string_list *list,
>  
>  			if (!match_leading_pathspec(NULL, pathspec,
>  						    match.buf, match.len,
> -						    0, NULL, e->d_type == DT_DIR ? 1 : 0))
> +						    0, NULL, DTYPE(e) == DT_DIR ? 1 : 0))
>  				continue;
>  		}

I confirm that before this patch the build will fail with the following
on AIX 7.3:

        CC diff-no-index.o
    diff-no-index.c: In function 'read_directory_contents':
    diff-no-index.c:49:21: error: 'struct dirent' has no member named 'd_type'
       49 |           0, NULL, e->d_type == DT_DIR ? 1 : 0))
          |                     ^~
    gmake: *** [Makefile:2821: diff-no-index.o] Error 1

This patch fixes it. Thanks.

Reviewed-by: Collin Funk <collin.funk1@xxxxxxxxx>

Collin





[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux