]> git.ipfire.org Git - thirdparty/util-linux.git/commit
libmount: improve EPERM interpretation
authorKarel Zak <kzak@redhat.com>
Thu, 3 Aug 2023 11:06:30 +0000 (13:06 +0200)
committerKarel Zak <kzak@redhat.com>
Wed, 16 Aug 2023 09:29:30 +0000 (11:29 +0200)
commitd14d39cbdd41eeb17401e9e64e240d7cb54e0516
treee06c8a1af55fd47a05587098979a77b5cae28302
parentce266c9e168d4f88ae04fea3f9984deb9d9a5dfd
libmount: improve EPERM interpretation

In some cases mount(2)/open_tree(2) returns EPERM for root user. In
this case libmount reports it as "mount point is not a directory".

It does not makes sense for bind mount where target could be a
regular file.

This patch is not ideal, the error handler is generic, but semantic
for new mount API and mount(2) is different. For example now it checks
for regular file, but the new API supports bind over symlinks, so
proper fix will require lstat() and S_ISLNK(), etc. We need to move
error messages to hook_mount.c and mount_mount_legacy.c to make it
more specific.

Fixes: https://github.com/util-linux/util-linux/issues/2413
Signed-off-by: Karel Zak <kzak@redhat.com>
libmount/src/context_mount.c