[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Specifying a mode to open when O_CREAT is used
From: |
Jose E. Marchesi |
Subject: |
Re: Specifying a mode to open when O_CREAT is used |
Date: |
Wed, 17 Mar 2021 22:10:06 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
>> open(2) says that a third argument `mode' is to be provided to `open'
>> when O_CREAT is specified in the flags.
>>
>> The specified mode is then combined with the umask to mount the
>> permissions for the newly created file (for future accesses). Right now
>> these permissions are none.
>>
>> So we have to specify a set of reasonable permissions.
>>
>> What about this:
>>
>> open (handler, flags_for_open,
>> S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
>>
>>
>> Note that the `mode' third argument to `open' is ignored if O_CREAT is
>> not in `flags'.
>>
>> WDYT?
>
> I did not check the permissions, indeed. My apologies.
> I pushed the change you suggested to both master and maint/poke-1.
Thanks!