diff options
author | Alan Somers <asomers@gmail.com> | 2019-05-15 14:35:57 -0600 |
---|---|---|
committer | Nikolaus Rath <Nikolaus@rath.org> | 2019-05-15 21:35:57 +0100 |
commit | 1f842c996e46788115d6b5ca142fad949712c8e9 (patch) | |
tree | 2a070544cd76fad641913c2b9a489712fc99e012 /example/passthrough_ll.c | |
parent | 7a5e1a9a9a61416c759ce02a48e600814fd13711 (diff) | |
download | libfuse-1f842c996e46788115d6b5ca142fad949712c8e9.tar.gz |
passthrough: fix unix-domain sockets on FreeBSD (#413)
FreeBSD doesn't allow creating sockets using mknod(2). Instead, one has to use socket(2)
and bind(2). Add appropriate logic to the examples and add a test case.
Diffstat (limited to 'example/passthrough_ll.c')
-rw-r--r-- | example/passthrough_ll.c | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/example/passthrough_ll.c b/example/passthrough_ll.c index b6ecaff..f0bc727 100644 --- a/example/passthrough_ll.c +++ b/example/passthrough_ll.c @@ -56,6 +56,8 @@ #include <sys/file.h> #include <sys/xattr.h> +#include "passthrough_helpers.h" + /* We are re-using pointers to our `struct lo_inode` and `struct lo_dirp` elements as inodes. This means that we must be able to store uintptr_t values in a fuse_ino_t variable. The following @@ -381,7 +383,6 @@ static void lo_mknod_symlink(fuse_req_t req, fuse_ino_t parent, const char *name, mode_t mode, dev_t rdev, const char *link) { - int newfd = -1; int res; int saverr; struct lo_inode *dir = lo_inode(req, parent); @@ -389,12 +390,8 @@ static void lo_mknod_symlink(fuse_req_t req, fuse_ino_t parent, saverr = ENOMEM; - if (S_ISDIR(mode)) - res = mkdirat(dir->fd, name, mode); - else if (S_ISLNK(mode)) - res = symlinkat(link, dir->fd, name); - else - res = mknodat(dir->fd, name, mode, rdev); + res = mknod_wrapper(dir->fd, name, link, mode, rdev); + saverr = errno; if (res == -1) goto out; @@ -411,8 +408,6 @@ static void lo_mknod_symlink(fuse_req_t req, fuse_ino_t parent, return; out: - if (newfd != -1) - close(newfd); fuse_reply_err(req, saverr); } |