public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Ken Brown <kbrown@cornell.edu>
To: "Lavrentiev, Anton (NIH/NLM/NCBI) [C]" <lavr@ncbi.nlm.nih.gov>,
	"cygwin@cygwin.com" <cygwin@cygwin.com>
Subject: Re: Weird issue with file permissions
Date: Sat, 2 Jul 2022 14:41:01 -0400	[thread overview]
Message-ID: <9e2a5f6a-b0cb-f7b5-a250-a6030ef24f09@cornell.edu> (raw)
In-Reply-To: <DM8PR09MB7095CE12D39F3F81CBB15536A5BC9@DM8PR09MB7095.namprd09.prod.outlook.com>

On 7/2/2022 12:16 PM, Lavrentiev, Anton (NIH/NLM/NCBI) [C] wrote:
> I forgot to mention that my "umask" is the standard 022...
> 
> The man page says that for directories with the ACLs, it is ignored.
> 
> So in my code bind() wouldn't have created the socket with 0777, and
> that's fine!  Which is why I call fchmod() to fix the permissions up,
> and THAT does not work.  BTW, should I have called chmod() instead (which
> is what the command line chmod does), the permissions would have been
> set correctly on the socket file, but fchmod() would have misreported
> them again (this time looks like a carryover from an earlier umask(0))!

I was focused on ACLs in my earlier responses and didn't think hard enough about 
what your test program was actually doing.  But you seem to be assuming that 
calling fchmod on a socket descriptor should affect the permissions on the 
socket file (assuming the socket is bound).  Is that documented anywhere?  POSIX 
says that the behavior of fchmod on a socket descriptor is unspecified 
(https://pubs.opengroup.org/onlinepubs/9699919799/functions/fchmod.html#tag_16_119).

Ken

  reply	other threads:[~2022-07-02 18:41 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-02 16:16 Lavrentiev, Anton (NIH/NLM/NCBI) [C]
2022-07-02 18:41 ` Ken Brown [this message]
2022-07-02 19:37   ` [EXTERNAL] " Lavrentiev, Anton (NIH/NLM/NCBI) [C]
2022-07-02 21:58     ` Ken Brown
2022-07-02 22:01     ` Andrey Repin
  -- strict thread matches above, loose matches on Subject: below --
2022-07-03  1:51 Lavrentiev, Anton (NIH/NLM/NCBI) [C]
2022-07-02  3:23 Lavrentiev, Anton (NIH/NLM/NCBI) [C]
2022-07-02 14:43 ` Ken Brown
2022-07-01 22:11 Lavrentiev, Anton (NIH/NLM/NCBI) [C]
2022-07-01 23:16 ` Ken Brown
2022-07-01 18:00 Lavrentiev, Anton (NIH/NLM/NCBI) [C]
2022-07-01 19:01 ` Ken Brown
2022-07-01 20:59 ` Ken Brown
2022-07-01  5:46 Lavrentiev, Anton (NIH/NLM/NCBI) [C]
2022-07-01 17:03 ` Ken Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9e2a5f6a-b0cb-f7b5-a250-a6030ef24f09@cornell.edu \
    --to=kbrown@cornell.edu \
    --cc=cygwin@cygwin.com \
    --cc=lavr@ncbi.nlm.nih.gov \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).