|
|
9a499a |
autofs-5.1.7 - remove redundant variables from mount_autofs_offset()
|
|
|
9a499a |
|
|
|
9a499a |
From: Ian Kent <raven@themaw.net>
|
|
|
9a499a |
|
|
|
9a499a |
The path to be mounted is the key in the passed in mapent.
|
|
|
9a499a |
|
|
|
9a499a |
Signed-off-by: Ian Kent <raven@themaw.net>
|
|
|
9a499a |
---
|
|
|
9a499a |
CHANGELOG | 1 +
|
|
|
9a499a |
daemon/direct.c | 42 +++++++++++++++++++-----------------------
|
|
|
9a499a |
include/automount.h | 2 +-
|
|
|
9a499a |
lib/mounts.c | 2 +-
|
|
|
9a499a |
4 files changed, 22 insertions(+), 25 deletions(-)
|
|
|
9a499a |
|
|
|
9a499a |
--- autofs-5.1.4.orig/CHANGELOG
|
|
|
9a499a |
+++ autofs-5.1.4/CHANGELOG
|
|
|
9a499a |
@@ -8,6 +8,7 @@
|
|
|
9a499a |
- fix is mounted check on non existent path.
|
|
|
9a499a |
- simplify cache_get_parent().
|
|
|
9a499a |
- set offset parent in update_offset_entry().
|
|
|
9a499a |
+- remove redundant variables from mount_autofs_offset().
|
|
|
9a499a |
|
|
|
9a499a |
xx/xx/2018 autofs-5.1.5
|
|
|
9a499a |
- fix flag file permission.
|
|
|
9a499a |
--- autofs-5.1.4.orig/daemon/direct.c
|
|
|
9a499a |
+++ autofs-5.1.4/daemon/direct.c
|
|
|
9a499a |
@@ -611,7 +611,7 @@ force_umount:
|
|
|
9a499a |
return rv;
|
|
|
9a499a |
}
|
|
|
9a499a |
|
|
|
9a499a |
-int mount_autofs_offset(struct autofs_point *ap, struct mapent *me, const char *root, const char *offset)
|
|
|
9a499a |
+int mount_autofs_offset(struct autofs_point *ap, struct mapent *me)
|
|
|
9a499a |
{
|
|
|
9a499a |
const char *str_offset = mount_type_str(t_offset);
|
|
|
9a499a |
struct ioctl_ops *ops = get_ioctl_ops();
|
|
|
9a499a |
@@ -623,7 +623,6 @@ int mount_autofs_offset(struct autofs_po
|
|
|
9a499a |
const char *hosts_map_name = "-hosts";
|
|
|
9a499a |
const char *map_name = hosts_map_name;
|
|
|
9a499a |
const char *type;
|
|
|
9a499a |
- char mountpoint[PATH_MAX];
|
|
|
9a499a |
struct mnt_list *mnt;
|
|
|
9a499a |
|
|
|
9a499a |
if (ops->version && ap->flags & MOUNT_FLAG_REMOUNT) {
|
|
|
9a499a |
@@ -681,11 +680,8 @@ int mount_autofs_offset(struct autofs_po
|
|
|
9a499a |
return MOUNT_OFFSET_OK;
|
|
|
9a499a |
}
|
|
|
9a499a |
|
|
|
9a499a |
- strcpy(mountpoint, root);
|
|
|
9a499a |
- strcat(mountpoint, offset);
|
|
|
9a499a |
-
|
|
|
9a499a |
/* In case the directory doesn't exist, try to mkdir it */
|
|
|
9a499a |
- if (mkdir_path(mountpoint, mp_mode) < 0) {
|
|
|
9a499a |
+ if (mkdir_path(me->key, mp_mode) < 0) {
|
|
|
9a499a |
if (errno == EEXIST) {
|
|
|
9a499a |
/*
|
|
|
9a499a |
* If the mount point directory is a real mount
|
|
|
9a499a |
@@ -694,7 +690,7 @@ int mount_autofs_offset(struct autofs_po
|
|
|
9a499a |
* the kernel NFS client.
|
|
|
9a499a |
*/
|
|
|
9a499a |
if (me->multi != me &&
|
|
|
9a499a |
- is_mounted(mountpoint, MNTS_REAL))
|
|
|
9a499a |
+ is_mounted(me->key, MNTS_REAL))
|
|
|
9a499a |
return MOUNT_OFFSET_IGNORE;
|
|
|
9a499a |
|
|
|
9a499a |
/*
|
|
|
9a499a |
@@ -714,13 +710,13 @@ int mount_autofs_offset(struct autofs_po
|
|
|
9a499a |
char *estr = strerror_r(errno, buf, MAX_ERR_BUF);
|
|
|
9a499a |
debug(ap->logopt,
|
|
|
9a499a |
"can't create mount directory: %s, %s",
|
|
|
9a499a |
- mountpoint, estr);
|
|
|
9a499a |
+ me->key, estr);
|
|
|
9a499a |
return MOUNT_OFFSET_FAIL;
|
|
|
9a499a |
} else {
|
|
|
9a499a |
char *estr = strerror_r(errno, buf, MAX_ERR_BUF);
|
|
|
9a499a |
crit(ap->logopt,
|
|
|
9a499a |
"failed to create mount directory: %s, %s",
|
|
|
9a499a |
- mountpoint, estr);
|
|
|
9a499a |
+ me->key, estr);
|
|
|
9a499a |
return MOUNT_OFFSET_FAIL;
|
|
|
9a499a |
}
|
|
|
9a499a |
} else {
|
|
|
9a499a |
@@ -730,56 +726,56 @@ int mount_autofs_offset(struct autofs_po
|
|
|
9a499a |
|
|
|
9a499a |
debug(ap->logopt,
|
|
|
9a499a |
"calling mount -t autofs " SLOPPY " -o %s automount %s",
|
|
|
9a499a |
- mp->options, mountpoint);
|
|
|
9a499a |
+ mp->options, me->key);
|
|
|
9a499a |
|
|
|
9a499a |
type = ap->entry->maps->type;
|
|
|
9a499a |
if (!type || strcmp(ap->entry->maps->type, "hosts"))
|
|
|
9a499a |
map_name = me->mc->map->argv[0];
|
|
|
9a499a |
|
|
|
9a499a |
- ret = mount(map_name, mountpoint, "autofs", MS_MGC_VAL, mp->options);
|
|
|
9a499a |
+ ret = mount(map_name, me->key, "autofs", MS_MGC_VAL, mp->options);
|
|
|
9a499a |
if (ret) {
|
|
|
9a499a |
crit(ap->logopt,
|
|
|
9a499a |
"failed to mount offset trigger %s at %s",
|
|
|
9a499a |
- me->key, mountpoint);
|
|
|
9a499a |
+ me->key, me->key);
|
|
|
9a499a |
goto out_err;
|
|
|
9a499a |
}
|
|
|
9a499a |
|
|
|
9a499a |
- ret = stat(mountpoint, &st);
|
|
|
9a499a |
+ ret = stat(me->key, &st);
|
|
|
9a499a |
if (ret == -1) {
|
|
|
9a499a |
error(ap->logopt,
|
|
|
9a499a |
- "failed to stat direct mount trigger %s", mountpoint);
|
|
|
9a499a |
+ "failed to stat direct mount trigger %s", me->key);
|
|
|
9a499a |
goto out_umount;
|
|
|
9a499a |
}
|
|
|
9a499a |
|
|
|
9a499a |
- ops->open(ap->logopt, &ioctlfd, st.st_dev, mountpoint);
|
|
|
9a499a |
+ ops->open(ap->logopt, &ioctlfd, st.st_dev, me->key);
|
|
|
9a499a |
if (ioctlfd < 0) {
|
|
|
9a499a |
- crit(ap->logopt, "failed to create ioctl fd for %s", mountpoint);
|
|
|
9a499a |
+ crit(ap->logopt, "failed to create ioctl fd for %s", me->key);
|
|
|
9a499a |
goto out_umount;
|
|
|
9a499a |
}
|
|
|
9a499a |
|
|
|
9a499a |
ops->timeout(ap->logopt, ioctlfd, timeout);
|
|
|
9a499a |
cache_set_ino_index(me->mc, me->key, st.st_dev, st.st_ino);
|
|
|
9a499a |
if (ap->logopt & LOGOPT_DEBUG)
|
|
|
9a499a |
- notify_mount_result(ap, mountpoint, timeout, str_offset);
|
|
|
9a499a |
+ notify_mount_result(ap, me->key, timeout, str_offset);
|
|
|
9a499a |
else
|
|
|
9a499a |
notify_mount_result(ap, me->key, timeout, str_offset);
|
|
|
9a499a |
ops->close(ap->logopt, ioctlfd);
|
|
|
9a499a |
|
|
|
9a499a |
- mnt = mnts_add_mount(ap, mountpoint, MNTS_OFFSET);
|
|
|
9a499a |
+ mnt = mnts_add_mount(ap, me->key, MNTS_OFFSET);
|
|
|
9a499a |
if (!mnt)
|
|
|
9a499a |
error(ap->logopt,
|
|
|
9a499a |
"failed to add offset mount %s to mounted list",
|
|
|
9a499a |
- mountpoint);
|
|
|
9a499a |
+ me->key);
|
|
|
9a499a |
|
|
|
9a499a |
- debug(ap->logopt, "mounted trigger %s at %s", me->key, mountpoint);
|
|
|
9a499a |
+ debug(ap->logopt, "mounted trigger %s", me->key);
|
|
|
9a499a |
|
|
|
9a499a |
return MOUNT_OFFSET_OK;
|
|
|
9a499a |
|
|
|
9a499a |
out_umount:
|
|
|
9a499a |
- umount(mountpoint);
|
|
|
9a499a |
+ umount(me->key);
|
|
|
9a499a |
out_err:
|
|
|
9a499a |
- if (stat(mountpoint, &st) == 0 && me->flags & MOUNT_FLAG_DIR_CREATED)
|
|
|
9a499a |
- rmdir_path(ap, mountpoint, st.st_dev);
|
|
|
9a499a |
+ if (stat(me->key, &st) == 0 && me->flags & MOUNT_FLAG_DIR_CREATED)
|
|
|
9a499a |
+ rmdir_path(ap, me->key, st.st_dev);
|
|
|
9a499a |
|
|
|
9a499a |
return MOUNT_OFFSET_FAIL;
|
|
|
9a499a |
}
|
|
|
9a499a |
--- autofs-5.1.4.orig/include/automount.h
|
|
|
9a499a |
+++ autofs-5.1.4/include/automount.h
|
|
|
9a499a |
@@ -595,7 +595,7 @@ int expire_offsets_direct(struct autofs_
|
|
|
9a499a |
int mount_autofs_indirect(struct autofs_point *ap, const char *root);
|
|
|
9a499a |
int do_mount_autofs_direct(struct autofs_point *ap, struct mapent *me, time_t timeout);
|
|
|
9a499a |
int mount_autofs_direct(struct autofs_point *ap);
|
|
|
9a499a |
-int mount_autofs_offset(struct autofs_point *ap, struct mapent *me, const char *root, const char *offset);
|
|
|
9a499a |
+int mount_autofs_offset(struct autofs_point *ap, struct mapent *me);
|
|
|
9a499a |
void submount_signal_parent(struct autofs_point *ap, unsigned int success);
|
|
|
9a499a |
void close_mount_fds(struct autofs_point *ap);
|
|
|
9a499a |
int umount_autofs_indirect(struct autofs_point *ap, const char *root);
|
|
|
9a499a |
--- autofs-5.1.4.orig/lib/mounts.c
|
|
|
9a499a |
+++ autofs-5.1.4/lib/mounts.c
|
|
|
9a499a |
@@ -2475,7 +2475,7 @@ static int do_mount_autofs_offset(struct
|
|
|
9a499a |
|
|
|
9a499a |
debug(ap->logopt, "mount offset %s at %s", oe->key, root);
|
|
|
9a499a |
|
|
|
9a499a |
- ret = mount_autofs_offset(ap, oe, root, offset);
|
|
|
9a499a |
+ ret = mount_autofs_offset(ap, oe);
|
|
|
9a499a |
if (ret >= MOUNT_OFFSET_OK)
|
|
|
9a499a |
mounted++;
|
|
|
9a499a |
else {
|