bug-gnulib
[Top][All Lists]
Advanced

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

Re: [Patch] Add dirent.d_type support to Cygwin 1.7 ?


From: James Youngman
Subject: Re: [Patch] Add dirent.d_type support to Cygwin 1.7 ?
Date: Sat, 29 Nov 2008 14:51:01 +0000

On Fri, Nov 28, 2008 at 7:19 PM, Jim Meyering <address@hidden> wrote:

First, many thanks for looking at this!


> +/* Map the dirent.d_type value, DTYPE, to the corresponding stat.st_mode
> +   S_IF* bit and set ST.st_mode, thus clearing all other bits in that field. 
>  */
> +static void
> +set_stat_type (struct stat *st, unsigned int dtype)
> +{
> +  mode_t type;
> +  switch (dtype)
> +    {
> +    case DT_BLK:
> +      type = S_IFBLK;
> +      break;
> +    case DT_CHR:
> +      type = S_IFCHR;
> +      break;
> +    case DT_DIR:
> +      type = S_IFDIR;
> +      break;
> +    case DT_FIFO:
> +      type = S_IFIFO;
> +      break;
> +    case DT_LNK:
> +      type = S_IFLNK;
> +      break;
> +    case DT_REG:
> +      type = S_IFREG;
> +      break;
> +    case DT_SOCK:
> +      type = S_IFSOCK;
> +      break;
> +    default:
> +      type = 0;
> +    }
> +  st->st_mode = dtype << s_ifmt_shift_bits ();
> +}

As far as I can see, the variable type is assigned in the function
above, but never used.   Did you mean to use "type" rather than
"dtype" in the expression which assigns to st->st_mode?

James.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]