Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/librefuse Move the call of fuse_operations::init() from ...
details: https://anonhg.NetBSD.org/src/rev/9d8afb8d9155
branches: trunk
changeset: 1026583:9d8afb8d9155
user: pho <pho%NetBSD.org@localhost>
date: Tue Nov 30 12:13:12 2021 +0000
description:
Move the call of fuse_operations::init() from fuse_new() to fuse_loop()
Prior to this change we were calling init() before daemonizing the
process. Some filesystems call chdir(2) in init() but fuse_daemonize()
call chdir("/"), which breaks assumptions about the state of the
process.
diffstat:
lib/librefuse/refuse.c | 19 ++++++++++++++-----
1 files changed, 14 insertions(+), 5 deletions(-)
diffs (47 lines):
diff -r 13ef97d1f8af -r 9d8afb8d9155 lib/librefuse/refuse.c
--- a/lib/librefuse/refuse.c Tue Nov 30 12:03:38 2021 +0000
+++ b/lib/librefuse/refuse.c Tue Nov 30 12:13:12 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: refuse.c,v 1.101 2019/09/23 12:00:57 christos Exp $ */
+/* $NetBSD: refuse.c,v 1.102 2021/11/30 12:13:12 pho Exp $ */
/*
* Copyright © 2007 Alistair Crooks. All rights reserved.
@@ -31,7 +31,7 @@
#include <sys/cdefs.h>
#if !defined(lint)
-__RCSID("$NetBSD: refuse.c,v 1.101 2019/09/23 12:00:57 christos Exp $");
+__RCSID("$NetBSD: refuse.c,v 1.102 2021/11/30 12:13:12 pho Exp $");
#endif /* !lint */
#include <sys/types.h>
@@ -1276,9 +1276,6 @@
fusectx->pid = 0;
fusectx->private_data = userdata;
- if (fuse->op.init != NULL)
- fusectx->private_data = fuse->op.init(NULL); /* XXX */
-
/* initialise the puffs operations structure */
PUFFSOP_INIT(pops);
@@ -1328,6 +1325,18 @@
int
fuse_loop(struct fuse *fuse)
{
+ if (fuse->op.init != NULL) {
+ struct fuse_context *fusectx = fuse_get_context();
+
+ /* XXX: prototype incompatible with FUSE: a secondary argument
+ * of struct fuse_config* needs to be passed.
+ *
+ * XXX: Our struct fuse_conn_info is not fully compatible with
+ * the FUSE one.
+ */
+ fusectx->private_data = fuse->op.init(NULL);
+ }
+
return puffs_mainloop(fuse->pu);
}
Home |
Main Index |
Thread Index |
Old Index