From: | Robert Haas <robertmhaas(at)gmail(dot)com> |
---|---|
To: | David Steele <david(at)pgmasters(dot)net> |
Cc: | "Tsunakawa, Takayuki" <tsunakawa(dot)takay(at)jp(dot)fujitsu(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Stephen Frost <sfrost(at)snowman(dot)net>, Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>, Adam Brightwell <adam(dot)brightwell(at)crunchydata(dot)com> |
Subject: | Re: PATCH: Configurable file mode mask |
Date: | 2018-01-03 13:11:25 |
Message-ID: | CA+Tgmob22bSXKCy5b4TVei7ZcQuPoj=z2JnTvBS3LnbiuyJfqQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Tue, Jan 2, 2018 at 11:43 AM, David Steele <david(at)pgmasters(dot)net> wrote:
>> > I think MakeDirectory() is a good wrapper, but isn't
>> MakeDirectoryPerm() sort of silly?
>
> There's one place in the backend (storage/ipc/ipc.c) that sets non-default
> directory permissions. This function is intended to support that and any
> extensions that need to set custom perms.
Yeah, but all it does is call mkdir(), which could just as well be
called directly. I think there's a pointer to a wrapper when it does
something for you -- supply an argument, log something, handle
portability concerns -- but this wrapper does exactly nothing.
>> + umask(~(stat_buf.st_mode & PG_DIR_MODE_DEFAULT));
>>
>> Hmm, I wonder if this is going to be 100% portable. Maybe some
>> obscure platform won't like an argument with all the high bits set.
>
> Sure - I have masked this with 0777 to clear any high bits. Sound OK?
Seems a little strange to spell it that way when we're using constants
everywhere else. How about writing it like this:
umask(PG_DIR_MODE_DEFAULT & ~stat_buf.st_mode);
I think that reads as "clear all bits from PG_DIR_MODE_DEFAULT that
are not set in stat_buf.st_mode", which sounds like what we want.
--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
From | Date | Subject | |
---|---|---|---|
Next Message | Peter Eisentraut | 2018-01-03 13:32:11 | Re: [HACKERS] GnuTLS support |
Previous Message | Jonathan S. Katz | 2018-01-03 12:47:04 | Re: CFM for January commitfest? |