summaryrefslogtreecommitdiffstats
path: root/mount/mount.c
diff options
context:
space:
mode:
Diffstat (limited to 'mount/mount.c')
-rw-r--r--mount/mount.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/mount/mount.c b/mount/mount.c
index e8cb54992..23d70cb14 100644
--- a/mount/mount.c
+++ b/mount/mount.c
@@ -2205,12 +2205,18 @@ main(int argc, char *argv[]) {
if (((uid_t)0 == ruid) && (ruid == euid)) {
restricted = 0;
}
- }
- if (restricted &&
- (types || options || readwrite || nomtab || mount_all ||
- fake || mounttype || (argc + specseen) != 1)) {
- die (EX_USAGE, _("mount: only root can do that"));
+ if (restricted &&
+ (types || options || readwrite || nomtab || mount_all ||
+ fake || mounttype || (argc + specseen) != 1)) {
+
+ if (ruid == 0 && euid != 0)
+ /* user is root, but setuid to non-root */
+ die (EX_USAGE, _("mount: only root can do that "
+ "(effective UID is %d)"), euid);
+
+ die (EX_USAGE, _("mount: only root can do that"));
+ }
}
atexit(unlock_mtab);