[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v4] daemon: Set ownership of kept build directories to the ca
From: |
Danny Milosavljevic |
Subject: |
Re: [PATCH v4] daemon: Set ownership of kept build directories to the calling user. |
Date: |
Fri, 23 Dec 2016 22:15:12 +0100 |
On Fri, 23 Dec 2016 14:33:31 +0100
John Darrington <address@hidden> wrote:
> On Fri, Dec 23, 2016 at 12:18:11PM +0100, Vincent Legoll wrote:
> Hello,
>
> + // Change the ownership if clientUid is set. Never change
> the
> + // ownership or the group to "root" for security reasons.
> + if (settings.clientUid != (uid_t) -1 && settings.clientUid
> != 0) {
>
> Is "0" a magical value that don't need casting or am I missing something
> ?
>
> Presumably clientUid is an unsigned integral type. Hence -1 does need a
> cast, whereas
> 0 does not.
Technically I agree. If it was my code I'd cast it regardless.
Also, why use the magical value 0 for gid? Why not likewise (gid_t) -1 ?