git: sbin/hammer: Use dirname(3) instead of getdir() in scanpfsid()

Tomohiro Kusumi tkusumi at
Sat Oct 8 18:29:56 PDT 2016

commit dc17a1e015ef129a262ee0244aefc362da2a13a0
Author: Tomohiro Kusumi <kusumi.tomohiro at>
Date:   Sat Oct 8 16:31:53 2016 +0900

    sbin/hammer: Use dirname(3) instead of getdir() in scanpfsid()
    scanpfsid() can use dirname(3) for fd instead of getdir().
    It's actually better to use dirname(3) which strips trailing /
    first and then return a pointer to directory path, instead of
    getdir() which only strips trailing / if any, because that's
    what scanpfsid() is trying to do with fd.
    If path is
        path/to/pfs -> @@...
    scanpfsid() wants to open("path/to"), and if path is
    which is @@.. itself if the PFS is not destroyed,
    scanpfsid() still wants to open("path/to").
    The second one doesn't occur since 8b640662 changed getpfs()
    to strip trailing / before calling scanpfsid().
    However the next commit is going to partly revert 8b640662,
    and this change makes the next 2 commits easier to implement,
    while being logically separated topic.

Summary of changes:
 sbin/hammer/cmd_pfs.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

DragonFly BSD source repository

More information about the Commits mailing list