Page MenuHomeFreeBSD

Return proper errno values in a few error paths.
ClosedPublic

Authored by rpokala on Feb 19 2018, 5:09 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Feb 16, 2:01 PM
Unknown Object (File)
Thu, Feb 13, 1:27 PM
Unknown Object (File)
Sat, Feb 8, 10:17 PM
Unknown Object (File)
Wed, Jan 29, 4:59 AM
Unknown Object (File)
Jan 19 2025, 2:00 PM
Unknown Object (File)
Jan 12 2025, 9:58 PM
Unknown Object (File)
Jan 6 2025, 10:58 PM
Unknown Object (File)
Sep 19 2024, 7:06 PM
Subscribers

Details

Summary

When attempting to mount a non-directory which exists, return ENOTDIR instead
of ENOENT. If stat() or statfs() failed, don't pass part of the invalid
(struct statfs) to ex_search(). In that same case, preserve the value of "bad"
rather than overwriting with EACCES.

Test Plan
  • mount a mountpoint that doesn't exist. For example

    mount -t nfs host:/usr0/bogus /mnt/host/usr0

    (where the directory "bogus" does not exist).

    The resulting error message should be "No such file or directory" rather than "Permission denied".
  • using a server that does not allow exports of regular files as mount points (i.e. mountd is run without the -r option), mount a mountpoint that is a regular file. For example

    mount -t nfs host /usr/smith/.cshrc /mnt/smith

    (where ".cshrc" is a regular file).

    The resulting error message should be "Not a directory" rather than "Permission denied" or "No such file or directory".

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 15151
Build 15237: arc lint + arc unit

Event Timeline

Looks ok to me at a glance. I don't know of any "standard" for what errors should be
returned. (Long ago it would have been "what Solaris does", but that's no longer the
case. If you wanted to, you could check to see if the error returns are "Linux compatible",
which is as close to a "standard" as there is these days.

This revision is now accepted and ready to land.Feb 20 2018, 10:35 PM
This revision was automatically updated to reflect the committed changes.