[pacman-dev] FS#7484 - pacman clobbers directory symlinks.

Dan McGee dpmcgee at gmail.com
Sat Jul 14 10:32:39 EDT 2007


On 7/14/07, Xavier <shiningxc at gmail.com> wrote:
> On Sat, Jul 14, 2007 at 01:53:37AM +0100, Andrew Fyfe wrote:
> > A little C help please :)
> >
> > Am I being really THICK? WTF is wrong with line 61?
> > (http://neptune-one.homeip.net/git?p=pacman;a=blob;f=lib/libalpm/util.h;h=19c6050d62ed14690686ed25214a7dfda8767bf4;hb=62e6bbcc2bd890c9981e52225ac1abcca4eb8c74#l57)
> > util.h:61: error: expected ')' before 'mode'
> >
> >
>
> I'm not good either. I first tried chaning mode_t to another fake type,
> it resulted in the same error, so it let me think mode_t was not defined.
> I tried to define a fake mode_t with :
> typedef int mode_t;
> but this resulted in another error about conflicting types, so I'm confused.
>
> Anyway, including <sys/types.h> where mode_t is defined apparently fix the
> problem, but I'm still confused.
>
> I didn't know about that strmode function, I thought about just using
> something like :
> if (buf.st_mode != archive_entry_mode(entry))
>   printf("%o != %o\n", buf.st_mode, archive_entry_mode(entry));

Including <sys/types.h> is the correct way to solve this problem here.
If you look at util.h, you will notice that <time.h> was already
included to give us the time_t type. Obviously you want to do as
little inclusion of headers in other headers as possible, but
sometimes it is unavoidable.

-Dan




More information about the pacman-dev mailing list