Re: [AD] Possible bug in src/libc.c

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


It may seem little stupid to answer my owne posts, but my code was wrong.
Stupid, stupid! I hope, it's correct now.

> if ((ff_info->stat.st_uid == geteuid())
>     && ((ff_info->stat.st_mode & S_IWUSR) == 0))
>          ffblk->ff_attrib |= FA_RDONLY;
> else if ((ff_info->stat.st_gid == getegid())
>     && ((ff_info->stat.st_mode & S_IWGRP) == 0))
>          ffblk->ff_attrib |= FA_RDONLY;
> else if ((ff_info->stat.st_mode & S_IWOTH) == 0)
>          ffblk->ff_attrib |= FA_RDONLY;

 if ((ff_info->stat.st_uid == geteuid()) {
     if ((ff_info->stat.st_mode & S_IWUSR) == 0))
          ffblk->ff_attrib |= FA_RDONLY;
 } else if ((ff_info->stat.st_gid == getegid()) {
     if ((ff_info->stat.st_mode & S_IWGRP) == 0))
          ffblk->ff_attrib |= FA_RDONLY;
 } else if ((ff_info->stat.st_mode & S_IWOTH) == 0) {
          ffblk->ff_attrib |= FA_RDONLY;
 }

> Code above was not tested (not even compiled) and was written from scratch
> directly into mail. It won't check against supplementary groups, which it
> should (to be perfect! :-) ).

Have a nice day.

Stepan Roh



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/