git: usr.sbin/autofs: Make automount(8) call chdir("/") before create_directory()

Tomohiro Kusumi tkusumi at crater.dragonflybsd.org
Fri Jan 12 12:15:53 PST 2018


commit 108ed43a1e5e7ff8f890085e206d970562bf4a7c
Author: Tomohiro Kusumi <kusumi.tomohiro at gmail.com>
Date:   Fri Jan 12 21:46:53 2018 +0200

    usr.sbin/autofs: Make automount(8) call chdir("/") before create_directory()
    
    https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=224601
    
    Unlike automountd where the daemon is daemonized or lesser-daemonized,
    an automount process isn't necessarily at /, and this results in
    creating unneeded directories at the current directory.
    
    In the example below, mounting autofs on /mnt/media fails because the
    command mkdirs mnt/media instead of /mnt/media. If /mnt/media already
    exists the command can mount autofs on /mnt/media, but it still mkdirs
    unneeded directories mnt/media.
    
    Calling chdir("/") before creation and restoring the directory after
    creation avoids this.
    
    --
    [root@]~# automount -L
    /mnt/media                -nosuid               -media               # indirect map referenced at /etc/auto_master:8
    [root@]~# ls mnt
    ls: mnt: No such file or directory
    [root@]~# automount
    automount: cannot mount map -media on /mnt/media: No such file or directory
    [root@]~# mount | grep autofs
    [root@]~# ls mnt
    media
    [root@]~# tree mnt
    mnt
    `-- media

Summary of changes:
 usr.sbin/autofs/automount.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/108ed43a1e5e7ff8f890085e206d970562bf4a7c


-- 
DragonFly BSD source repository


More information about the Commits mailing list