<feed xmlns='http://www.w3.org/2005/Atom'>
<title>gocryptfs/internal/syscallcompat/reopen_linux.go, branch master</title>
<subtitle>Mirror of gocryptfs source code on Github</subtitle>
<id>http://nuetzlich.net/cgit/gocryptfs/atom?h=master</id>
<link rel='self' href='http://nuetzlich.net/cgit/gocryptfs/atom?h=master'/>
<link rel='alternate' type='text/html' href='http://nuetzlich.net/cgit/gocryptfs/'/>
<updated>2026-11-11T20:08:01+00:00</updated>
<entry>
<title>fusefrontend: openWriteOnlyFile: reopen the same file, not just the same name</title>
<updated>2026-11-11T20:08:01+00:00</updated>
<author>
<name>Jakob Unterwurzacher</name>
</author>
<published>2026-11-11T20:05:14+00:00</published>
<link rel='alternate' type='text/html' href='http://nuetzlich.net/cgit/gocryptfs/commit/?id=8caa5dddeebaf7116c9fa12a64cac1aca567df58'/>
<id>urn:sha1:8caa5dddeebaf7116c9fa12a64cac1aca567df58</id>
<content type='text'>
openWriteOnlyFile chmods the file via woFd and then reopens it by name.
O_NOFOLLOW prevents following symlinks, but cName could still have been
replaced by a different regular file in between, and we would return an
fd to that file.

Add syscallcompat.ReopenFd():
* Linux: open /proc/self/fd/N, which always resolves to the file woFd
  refers to.
* Other platforms: reopen by name and compare dev/ino against woFd,
  returning EAGAIN on mismatch.

Co-Authored-By: Claude Opus 5.5 &lt;noreply@anthropic.com&gt;
</content>
</entry>
</feed>
