mirror of
https://github.com/libfuse/libfuse.git
synced 2026-07-07 14:47:41 +08:00
mount_service: use the fsmount API helpers from mount_fsmount.c
The new fsmount API code in mount_service.c should use the new helper functions that were recently added to mount_fsmount.c. Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
This commit is contained in:
+15
-59
@@ -35,16 +35,7 @@
|
||||
#define MOUNT_ATTR_NOSYMFOLLOW 0x00200000
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Convert MS_* mount flags to MOUNT_ATTR_* mount attributes.
|
||||
* These flags are passed to fsmount(), not fsconfig().
|
||||
* Mount attributes control mount-point level behavior.
|
||||
* To called after set_ms_flags() which consumes the fsconfig flags.
|
||||
*
|
||||
* @mount_attrs MOUNT_ATTR flags, built from MS_ flags
|
||||
* @return remaining MS_* flags
|
||||
*/
|
||||
static unsigned long ms_flags_to_mount_attrs(unsigned long ms_flags,
|
||||
unsigned long ms_flags_to_mount_attrs(unsigned long ms_flags,
|
||||
unsigned int *mount_attrs)
|
||||
{
|
||||
int i;
|
||||
@@ -65,12 +56,7 @@ static unsigned long ms_flags_to_mount_attrs(unsigned long ms_flags,
|
||||
return ms_flags;
|
||||
}
|
||||
|
||||
/*
|
||||
* Read and print kernel error messages from fsopen fd.
|
||||
* The kernel can provide detailed error/warning/info messages via the
|
||||
* filesystem context fd that are more informative than strerror(errno).
|
||||
*/
|
||||
static void log_fsconfig_kmsg(int fd)
|
||||
void log_fsconfig_kmsg(int fd)
|
||||
{
|
||||
char buf[4096];
|
||||
int err, sz = 0;
|
||||
@@ -107,19 +93,7 @@ static void log_fsconfig_kmsg(int fd)
|
||||
errno = err;
|
||||
}
|
||||
|
||||
/*
|
||||
* Apply VFS superblock (fsconfig) flags to the filesystem context.
|
||||
* Handles the fsconfig leg of every entry whose is_fsconfig is set
|
||||
* (ro, rw, sync, async, dirsync). Mount attributes (nosuid, nodev, etc.)
|
||||
* are handled separately via fsmount().
|
||||
*
|
||||
* Entries that have *both* legs (ro/rw) leave the MS_ bit in *ms_flags
|
||||
* so that ms_flags_to_mount_attrs() can also pick them up.
|
||||
*
|
||||
* @ms_flags flags to set, outvalue are the remaining flags
|
||||
* @return 0 on success, negative error code on failure
|
||||
*/
|
||||
static int set_ms_flags(int fsfd, unsigned long *ms_flags)
|
||||
int set_fsconfig_ms_flags(int fsfd, unsigned long *ms_flags)
|
||||
{
|
||||
int ret, flags = *ms_flags;
|
||||
int i;
|
||||
@@ -155,16 +129,7 @@ static int set_ms_flags(int fsfd, unsigned long *ms_flags)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Apply the "fd" parameter via fsconfig
|
||||
*
|
||||
* Special handler for the "fd" mount option. Note that despite the name,
|
||||
* the fd parameter is passed as a u32 string value, not as a file descriptor
|
||||
* to pass to the kernel. Uses FSCONFIG_SET_STRING rather than FSCONFIG_SET_FD.
|
||||
*
|
||||
* Returns 0 on success, negative error code on failure.
|
||||
*/
|
||||
static int apply_opt_fd(int fsfd, const char *value)
|
||||
int apply_fsconfig_opt_fd(int fsfd, const char *value)
|
||||
{
|
||||
int res;
|
||||
|
||||
@@ -181,15 +146,7 @@ static int apply_opt_fd(int fsfd, const char *value)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Apply a key=value string option via fsconfig
|
||||
*
|
||||
* Applies a mount option that consists of a key-value pair (e.g., "rootmode=40000").
|
||||
* Uses FSCONFIG_SET_STRING to pass the key and value to the filesystem configuration.
|
||||
*
|
||||
* Returns 0 on success, negative error code on failure.
|
||||
*/
|
||||
static int apply_opt_string(int fsfd, const char *key, const char *value)
|
||||
int apply_fsconfig_opt_string(int fsfd, const char *key, const char *value)
|
||||
{
|
||||
int res, save_errno;
|
||||
|
||||
@@ -210,6 +167,8 @@ static int apply_opt_string(int fsfd, const char *key, const char *value)
|
||||
* Applies a mount option that is a simple flag without a value (e.g., "rw").
|
||||
* Uses FSCONFIG_SET_FLAG to set the flag in the filesystem configuration.
|
||||
*
|
||||
* @fsfd fsopen fd
|
||||
* @opt name of filesystem mount flag option
|
||||
* Returns 0 on success, negative error code on failure.
|
||||
*/
|
||||
static int apply_opt_flag(int fsfd, const char *opt)
|
||||
@@ -227,7 +186,6 @@ static int apply_opt_flag(int fsfd, const char *opt)
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Parse and apply a single mount option via fsconfig
|
||||
*
|
||||
@@ -238,6 +196,8 @@ static int apply_opt_flag(int fsfd, const char *opt)
|
||||
* Special handling for the "fd" parameter which is treated as a string
|
||||
* value rather than a file descriptor to pass.
|
||||
*
|
||||
* @fsfd fsopen fd
|
||||
* @opt filesystem mount option, may be modified
|
||||
* Returns 0 on success, negative error code on failure.
|
||||
*/
|
||||
static int apply_opt_key_value(int fsfd, char *opt)
|
||||
@@ -255,9 +215,9 @@ static int apply_opt_key_value(int fsfd, char *opt)
|
||||
value = eq + 1;
|
||||
|
||||
if (strcmp(key, "fd") == 0)
|
||||
return apply_opt_fd(fsfd, value);
|
||||
return apply_fsconfig_opt_fd(fsfd, value);
|
||||
|
||||
return apply_opt_string(fsfd, key, value);
|
||||
return apply_fsconfig_opt_string(fsfd, key, value);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -287,11 +247,7 @@ static int is_mtab_only_opt(const char *opt)
|
||||
strcmp(opt, "rw") == 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Parse kernel options string and apply via fsconfig
|
||||
* Options are comma-separated key=value pairs
|
||||
*/
|
||||
static int apply_mount_opts(int fsfd, const char *opts)
|
||||
int apply_fsconfig_mount_opts(int fsfd, const char *opts)
|
||||
{
|
||||
char *opts_copy;
|
||||
char *opt;
|
||||
@@ -393,12 +349,12 @@ int fuse_kern_fsmount(const char *mnt, unsigned long flags, int blkdev,
|
||||
}
|
||||
|
||||
/* Apply VFS superblock (fsconfig) flags (ro, sync, dirsync) */
|
||||
res = set_ms_flags(fsfd, &flags);
|
||||
res = set_fsconfig_ms_flags(fsfd, &flags);
|
||||
if (res != 0)
|
||||
goto out_free;
|
||||
|
||||
/* Apply kernel options */
|
||||
err = apply_mount_opts(fsfd, kernel_opts);
|
||||
err = apply_fsconfig_mount_opts(fsfd, kernel_opts);
|
||||
if (err < 0) {
|
||||
log_fsconfig_kmsg(fsfd);
|
||||
fprintf(stderr,
|
||||
@@ -408,7 +364,7 @@ int fuse_kern_fsmount(const char *mnt, unsigned long flags, int blkdev,
|
||||
}
|
||||
|
||||
/* Apply mtab options (overlap with kernel_opts is filtered and tolerated) */
|
||||
err = apply_mount_opts(fsfd, mtab_opts);
|
||||
err = apply_fsconfig_mount_opts(fsfd, mtab_opts);
|
||||
if (err < 0) {
|
||||
log_fsconfig_kmsg(fsfd);
|
||||
fprintf(stderr,
|
||||
|
||||
@@ -65,4 +65,76 @@ int mount_fusermount_obtain_fd(const char *mountpoint,
|
||||
|
||||
int fuse_fusermount_proceed_mnt(int sock_fd);
|
||||
|
||||
/**
|
||||
* Convert MS_* mount flags to MOUNT_ATTR_* mount attributes.
|
||||
* These flags are passed to fsmount(), not fsconfig().
|
||||
* Mount attributes control mount-point level behavior.
|
||||
* To called after set_ms_flags() which consumes the fsconfig flags.
|
||||
*
|
||||
* @mount_attrs MOUNT_ATTR flags, built from MS_ flags
|
||||
* @return remaining MS_* flags
|
||||
*/
|
||||
unsigned long ms_flags_to_mount_attrs(unsigned long ms_flags,
|
||||
unsigned int *mount_attrs);
|
||||
|
||||
/**
|
||||
* Read and print kernel error messages from fsopen fd.
|
||||
* The kernel can provide detailed error/warning/info messages via the
|
||||
* filesystem context fd that are more informative than strerror(errno).
|
||||
*
|
||||
* @fd fsopen fd
|
||||
*/
|
||||
void log_fsconfig_kmsg(int fd);
|
||||
|
||||
/**
|
||||
* Apply VFS superblock (fsconfig) flags to the filesystem context.
|
||||
* Handles the fsconfig leg of every entry whose is_fsconfig is set
|
||||
* (ro, rw, sync, async, dirsync). Mount attributes (nosuid, nodev, etc.)
|
||||
* are handled separately via fsmount().
|
||||
*
|
||||
* Entries that have *both* legs (ro/rw) leave the MS_ bit in *ms_flags
|
||||
* so that ms_flags_to_mount_attrs() can also pick them up.
|
||||
*
|
||||
* @fsfd fsopen fd
|
||||
* @ms_flags flags to set, outvalue are the remaining flags
|
||||
* @return 0 on success, negative error code on failure
|
||||
*/
|
||||
int set_fsconfig_ms_flags(int fsfd, unsigned long *ms_flags);
|
||||
|
||||
/**
|
||||
* Apply the "fd" parameter via fsconfig
|
||||
*
|
||||
* Special handler for the "fd" mount option. Note that despite the name,
|
||||
* the fd parameter is passed as a u32 string value, not as a file descriptor
|
||||
* to pass to the kernel. Uses FSCONFIG_SET_STRING rather than FSCONFIG_SET_FD.
|
||||
*
|
||||
* @fsfd fsopen fd
|
||||
* @value fd number of /dev/fuse, as a string
|
||||
* Returns 0 on success, negative error code on failure.
|
||||
*/
|
||||
int apply_fsconfig_opt_fd(int fsfd, const char *value);
|
||||
|
||||
/**
|
||||
* Apply a key=value string option via fsconfig
|
||||
*
|
||||
* Applies a mount option that consists of a key-value pair (e.g., "rootmode=40000").
|
||||
* Uses FSCONFIG_SET_STRING to pass the key and value to the filesystem configuration.
|
||||
*
|
||||
* @fsfd fsopen fd
|
||||
* @key name of filesystem mount option
|
||||
* @value value of mount option
|
||||
* Returns 0 on success, negative error code on failure.
|
||||
*/
|
||||
int apply_fsconfig_opt_string(int fsfd, const char *key, const char *value);
|
||||
|
||||
/**
|
||||
* Parse kernel options string and apply via fsconfig
|
||||
* Options are comma-separated key=value pairs
|
||||
*
|
||||
* @fsfd fsopen fd
|
||||
* @opt filesystem mount option string
|
||||
* Returns 0 on success, negative error code on failure.
|
||||
*/
|
||||
int apply_fsconfig_mount_opts(int fsfd, const char *opts);
|
||||
|
||||
#endif /* FUSE_MOUNT_I_LINUX_H_ */
|
||||
|
||||
@@ -11,6 +11,9 @@ mount_service_sources = []
|
||||
mount_service_cflags = []
|
||||
if private_cfg.get('HAVE_SERVICEMOUNT', false)
|
||||
mount_service_sources += ['mount_service.c', '../lib/mount_util.c', 'fuser_conf.c']
|
||||
if private_cfg.get('HAVE_NEW_MOUNT_API', false)
|
||||
mount_service_sources += [ '../lib/mount_fsmount.c' ]
|
||||
endif
|
||||
mount_service_cflags += ['-DFUSE_CONF="@0@"'.format(fuseconf_path)]
|
||||
fuservicemount_path = join_paths(get_option('prefix'), get_option('sbindir'))
|
||||
mount_service_cflags += ['-DFUSERVICEMOUNT_DIR="@0@"'.format(fuservicemount_path)]
|
||||
|
||||
+46
-171
@@ -39,6 +39,9 @@
|
||||
#include "fuse_service_priv.h"
|
||||
#include "mount_service.h"
|
||||
#include "fuser_conf.h"
|
||||
#ifdef HAVE_NEW_MOUNT_API
|
||||
#include "mount_i_linux.h"
|
||||
#endif
|
||||
|
||||
struct mount_service {
|
||||
/* prefix for printing error messages */
|
||||
@@ -875,40 +878,6 @@ static int mount_service_handle_fsopen_cmd(struct mount_service *mo,
|
||||
return mount_service_send_reply(mo, 0);
|
||||
}
|
||||
|
||||
#ifdef HAVE_NEW_MOUNT_API
|
||||
/* callers must preserve errno */
|
||||
static void emit_fsconfig_messages(const struct mount_service *mo)
|
||||
{
|
||||
uint8_t buf[BUFSIZ];
|
||||
ssize_t sz;
|
||||
|
||||
while ((sz = read(mo->fsopenfd, buf, sizeof(buf) - 1)) >= 1) {
|
||||
if (buf[sz - 1] == '\n')
|
||||
buf[--sz] = '\0';
|
||||
else
|
||||
buf[sz] = '\0';
|
||||
|
||||
if (!*buf)
|
||||
continue;
|
||||
|
||||
switch (buf[0]) {
|
||||
case 'e':
|
||||
fprintf(stderr, "Error: %s\n", buf + 2);
|
||||
break;
|
||||
case 'w':
|
||||
fprintf(stderr, "Warning: %s\n", buf + 2);
|
||||
break;
|
||||
case 'i':
|
||||
fprintf(stderr, "Info: %s\n", buf + 2);
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr, " %s\n", buf);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
static int mount_service_handle_source_cmd(struct mount_service *mo,
|
||||
const struct fuse_service_packet *p,
|
||||
size_t psz)
|
||||
@@ -946,16 +915,11 @@ static int mount_service_handle_source_cmd(struct mount_service *mo,
|
||||
|
||||
#ifdef HAVE_NEW_MOUNT_API
|
||||
if (mo->fsopenfd >= 0) {
|
||||
int ret = fsconfig(mo->fsopenfd, FSCONFIG_SET_STRING, "source",
|
||||
oc->value, 0);
|
||||
if (ret) {
|
||||
int error = errno;
|
||||
|
||||
fprintf(stderr, "%s: fsconfig source: %s\n",
|
||||
mo->msgtag, strerror(error));
|
||||
emit_fsconfig_messages(mo);
|
||||
int ret = apply_fsconfig_opt_string(mo->fsopenfd, "source",
|
||||
oc->value);
|
||||
if (ret < 0) {
|
||||
free(source);
|
||||
return mount_service_send_reply(mo, error);
|
||||
return mount_service_send_reply(mo, -ret);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -1002,54 +966,31 @@ static int mount_service_handle_mntopts_cmd(struct mount_service *mo,
|
||||
}
|
||||
|
||||
/* strtok_r mutates tokstr aka oc->value */
|
||||
if (getuid() != 0 && !user_allow_other) {
|
||||
while ((tok = strtok_r(tokstr, ",", &savetok)) != NULL) {
|
||||
char *equals = strchr(tok, '=');
|
||||
char oldchar = 0;
|
||||
|
||||
if (equals) {
|
||||
oldchar = *equals;
|
||||
*equals = 0;
|
||||
}
|
||||
|
||||
if (getuid() != 0 && !user_allow_other &&
|
||||
(!strcmp(tok, "allow_other") ||
|
||||
!strcmp(tok, "allow_root"))) {
|
||||
if (!strcmp(tok, "allow_other") ||
|
||||
!strcmp(tok, "allow_root")) {
|
||||
fprintf(stderr,
|
||||
"%s: option %s only allowed if 'user_allow_other' is set in %s\n",
|
||||
"%s: option %s only allowed if 'user_allow_other' is set in %s\n",
|
||||
mo->msgtag, tok, FUSE_CONF);
|
||||
return mount_service_send_reply(mo, EPERM);
|
||||
}
|
||||
|
||||
tokstr = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef HAVE_NEW_MOUNT_API
|
||||
if (mo->fsopenfd >= 0) {
|
||||
int ret;
|
||||
int ret = apply_fsconfig_mount_opts(mo->fsopenfd, oc->value);
|
||||
|
||||
if (equals)
|
||||
ret = fsconfig(mo->fsopenfd,
|
||||
FSCONFIG_SET_STRING, tok,
|
||||
equals + 1, 0);
|
||||
else
|
||||
ret = fsconfig(mo->fsopenfd,
|
||||
FSCONFIG_SET_FLAG, tok,
|
||||
NULL, 0);
|
||||
if (ret) {
|
||||
int error = errno;
|
||||
|
||||
fprintf(stderr, "%s: set mount option: %s\n",
|
||||
mo->msgtag, strerror(error));
|
||||
emit_fsconfig_messages(mo);
|
||||
if (ret < 0) {
|
||||
free(mntopts);
|
||||
return mount_service_send_reply(mo, error);
|
||||
return mount_service_send_reply(mo, -ret);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (equals)
|
||||
*equals = oldchar;
|
||||
|
||||
tokstr = NULL;
|
||||
}
|
||||
|
||||
mo->mntopts = mntopts;
|
||||
return mount_service_send_reply(mo, 0);
|
||||
}
|
||||
@@ -1452,66 +1393,6 @@ out_realmopts:
|
||||
}
|
||||
|
||||
#ifdef HAVE_NEW_MOUNT_API
|
||||
struct ms_to_mount_map {
|
||||
unsigned long ms_flag;
|
||||
unsigned int mount_attr_flag;
|
||||
};
|
||||
|
||||
static void get_mount_attr_flags(const struct fuse_service_mount_command *oc,
|
||||
unsigned int *attr_flags,
|
||||
unsigned long *leftover_ms_flags)
|
||||
{
|
||||
const struct mount_flags *i;
|
||||
unsigned int ms_flags = ntohl(oc->ms_flags);
|
||||
unsigned int mount_attr_flags = 0;
|
||||
|
||||
for (i = mount_flags; i->opt != NULL; i++) {
|
||||
if (!i->on || !(ms_flags & i->flag))
|
||||
continue;
|
||||
|
||||
mount_attr_flags |= i->mount_attr;
|
||||
ms_flags &= ~i->flag;
|
||||
}
|
||||
|
||||
*leftover_ms_flags = ms_flags;
|
||||
*attr_flags = mount_attr_flags;
|
||||
}
|
||||
|
||||
static int set_ms_flags(struct mount_service *mo, unsigned long ms_flags)
|
||||
{
|
||||
const struct mount_flags *i;
|
||||
int ret;
|
||||
|
||||
for (i = mount_flags; i->opt != NULL; i++) {
|
||||
if (!i->on || !(ms_flags & i->flag))
|
||||
continue;
|
||||
|
||||
ret = fsconfig(mo->fsopenfd, FSCONFIG_SET_FLAG, i->opt,
|
||||
NULL, 0);
|
||||
if (ret) {
|
||||
int error = errno;
|
||||
|
||||
fprintf(stderr, "%s: set %s option: %s\n",
|
||||
mo->msgtag, i->opt, strerror(error));
|
||||
emit_fsconfig_messages(mo);
|
||||
|
||||
errno = error;
|
||||
return -1;
|
||||
}
|
||||
ms_flags &= ~i->flag;
|
||||
}
|
||||
|
||||
/*
|
||||
* We can't translate all the supplied MS_ flags into MOUNT_ATTR_ flags
|
||||
* or string flags! Return a magic code so the caller will fall back
|
||||
* to regular mount(2).
|
||||
*/
|
||||
if (ms_flags)
|
||||
return FUSE_MOUNT_FALLBACK_NEEDED;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int mount_service_fsopen_mount(struct mount_service *mo,
|
||||
const struct fuse_service_mount_command *oc,
|
||||
const struct stat *stbuf)
|
||||
@@ -1523,63 +1404,57 @@ static int mount_service_fsopen_mount(struct mount_service *mo,
|
||||
int error;
|
||||
int ret;
|
||||
|
||||
get_mount_attr_flags(oc, &attr_flags, &ms_flags);
|
||||
ms_flags = ms_flags_to_mount_attrs(ntohl(oc->ms_flags), &attr_flags);
|
||||
|
||||
ret = set_ms_flags(mo, ms_flags);
|
||||
if (ret == FUSE_MOUNT_FALLBACK_NEEDED)
|
||||
return ret;
|
||||
ret = set_fsconfig_ms_flags(mo->fsopenfd, &ms_flags);
|
||||
if (ret) {
|
||||
error = errno;
|
||||
goto fail_mount;
|
||||
}
|
||||
|
||||
ret = fsconfig(mo->fsopenfd, FSCONFIG_SET_STRING, "subtype",
|
||||
mo->subtype, 0);
|
||||
if (ret) {
|
||||
error = errno;
|
||||
|
||||
/* The subtype option was merged after fsopen */
|
||||
if (error == EINVAL)
|
||||
/*
|
||||
* We can't translate all the supplied MS_ flags into MOUNT_ATTR_ flags
|
||||
* or string flags! Return a magic code so the caller will fall back
|
||||
* to regular mount(2).
|
||||
*/
|
||||
if (ms_flags)
|
||||
return FUSE_MOUNT_FALLBACK_NEEDED;
|
||||
|
||||
fprintf(stderr, "%s: set subtype option: %s\n",
|
||||
mo->msgtag, strerror(error));
|
||||
ret = apply_fsconfig_opt_string(mo->fsopenfd, "subtype", mo->subtype);
|
||||
if (ret < 0) {
|
||||
/* The subtype option was merged after fsopen */
|
||||
if (ret == -EINVAL)
|
||||
return FUSE_MOUNT_FALLBACK_NEEDED;
|
||||
|
||||
error = -ret;
|
||||
goto fail_fsconfig;
|
||||
}
|
||||
|
||||
snprintf(tmp, sizeof(tmp), "%i", mo->fusedevfd);
|
||||
ret = fsconfig(mo->fsopenfd, FSCONFIG_SET_STRING, "fd", tmp, 0);
|
||||
if (ret) {
|
||||
error = errno;
|
||||
fprintf(stderr, "%s: set fd option: %s\n",
|
||||
mo->msgtag, strerror(error));
|
||||
ret = apply_fsconfig_opt_fd(mo->fsopenfd, tmp);
|
||||
if (ret < 0) {
|
||||
error = -ret;
|
||||
goto fail_fsconfig;
|
||||
}
|
||||
|
||||
snprintf(tmp, sizeof(tmp), "%o", stbuf->st_mode & S_IFMT);
|
||||
ret = fsconfig(mo->fsopenfd, FSCONFIG_SET_STRING, "rootmode", tmp, 0);
|
||||
if (ret) {
|
||||
error = errno;
|
||||
fprintf(stderr, "%s: set rootmode option: %s\n",
|
||||
mo->msgtag, strerror(error));
|
||||
ret = apply_fsconfig_opt_string(mo->fsopenfd, "rootmode", tmp);
|
||||
if (ret < 0) {
|
||||
error = -ret;
|
||||
goto fail_fsconfig;
|
||||
}
|
||||
|
||||
snprintf(tmp, sizeof(tmp), "%u", getuid());
|
||||
ret = fsconfig(mo->fsopenfd, FSCONFIG_SET_STRING, "user_id", tmp, 0);
|
||||
if (ret) {
|
||||
error = errno;
|
||||
fprintf(stderr, "%s: set user_id option: %s\n",
|
||||
mo->msgtag, strerror(error));
|
||||
ret = apply_fsconfig_opt_string(mo->fsopenfd, "user_id", tmp);
|
||||
if (ret < 0) {
|
||||
error = -ret;
|
||||
goto fail_fsconfig;
|
||||
}
|
||||
|
||||
snprintf(tmp, sizeof(tmp), "%u", getgid());
|
||||
ret = fsconfig(mo->fsopenfd, FSCONFIG_SET_STRING, "group_id", tmp, 0);
|
||||
if (ret) {
|
||||
error = errno;
|
||||
fprintf(stderr, "%s: set group_id option: %s\n",
|
||||
mo->msgtag, strerror(error));
|
||||
ret = apply_fsconfig_opt_string(mo->fsopenfd, "group_id", tmp);
|
||||
if (ret < 0) {
|
||||
error = -ret;
|
||||
goto fail_fsconfig;
|
||||
}
|
||||
|
||||
@@ -1629,7 +1504,7 @@ static int mount_service_fsopen_mount(struct mount_service *mo,
|
||||
return mount_service_send_reply(mo, 0);
|
||||
|
||||
fail_fsconfig:
|
||||
emit_fsconfig_messages(mo);
|
||||
log_fsconfig_kmsg(mo->fsopenfd);
|
||||
fail_mount:
|
||||
return mount_service_send_reply(mo, error);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user