[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Specifying a mode to open when O_CREAT is used

From: Egeyar Bagcioglu
Subject: Re: Specifying a mode to open when O_CREAT is used
Date: Wed, 17 Mar 2021 20:39:18 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.0

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'.


I did not check the permissions, indeed. My apologies.
I pushed the change you suggested to both master and maint/poke-1.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]