mirror of
https://github.com/RsyncProject/rsync.git
synced 2026-09-12 21:28:25 -04:00
vfs: port 37dbb263's operator-path mknod FIFO/socket fallback
Linear-rebase counterpart of the round-2 merge resolution: 37dbb263 fixed do_mknod_at()'s operator branch in syscall.c (deleted on this branch) to fall back to mkfifoat() for a FIFO and EOPNOTSUPP for a nested socket when mknodat() can't make a special file on the BSDs/macOS/Solaris. Re-express it in the VFS_OPERATOR_PATH branch of vfs__mknod_secure() in vfs/mknod.c, mirroring the secure-relpath branch already in that function. Tree is byte-identical to the validated round-2 merge result.
This commit is contained in:
1 parent
e0f2f52670
commit
fbfa40fe4d
1 file changed
+13
+13
@@ -126,6 +126,19 @@ static int vfs__mknod_secure(const char *pathname, mode_t mode, dev_t dev, int f
|
||||
if (dfd < 0)
|
||||
return -1;
|
||||
ret = mknodat(dfd, bname, mode, dev);
|
||||
if (ret < 0) {
|
||||
/* mknodat() can't make a FIFO/socket on the BSDs/macOS/
|
||||
* Solaris (EINVAL); retry race-safely on the held dirfd,
|
||||
* mirroring the secure-relpath path below. Without this a
|
||||
* FIFO backup to an operator --backup-dir fails there. */
|
||||
#ifdef HAVE_MKFIFOAT
|
||||
if (S_ISFIFO(mode))
|
||||
ret = mkfifoat(dfd, bname, mode);
|
||||
else
|
||||
#endif
|
||||
if (S_ISSOCK(mode))
|
||||
errno = EOPNOTSUPP; /* no dirfd-relative socket bind */
|
||||
}
|
||||
e = errno;
|
||||
close(dfd);
|
||||
errno = e;
|
||||
|
||||
Reference in new issue
Block a user