[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [MiNT] st_flags in 'stat' structure
On 11/15/11 20:32, Miro Kropáček wrote:
> Hi,
>
> can anybody tell me what's the official meaning of the 'st_flags'
> member of the 'stat' structure? zView uses it in a pretty dangerous way:
>
> if ( stat( de->d_name, &file_stat) != 0)
> continue;
> if (( file_stat.st_flags & 2) == FA_HIDDEN)
> ...
>
> but in mintlib, I see it's reserved for some user data and even there
> some strange code is done (files do_stat.c and quickstat.c):
>
> st->st_flags = 0;
> st->st_mode = 0644 | (isdir ? S_IFDIR | 0111 : S_IFREG);
> :
> [nothing changes st_flags nor the 'st' structure]
> :
> if (st->st_flags & FA_RDONLY)
> st->st_mode &= ~0222; /* no write permission */
> if (st->st_flags & FA_HIDDEN)
> st->st_mode &= ~0444; /* no read permission */
>
> Yeah, that's right, it zeroes the variable and then test it for some
> TOS-only flags. I think it's quite a mess because it's nowhere
> documented plus it doesn't do what one could guess it is supposed to
> do (i.e. setting TOS-compatible flags in a Unix call).
>
Yep, certainly looks broken for the TOS fallback path.
Alan.