1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-18 10:04:20 +03:00

Print warning when lvm tools are running as non-root.

This commit is contained in:
Petr Rockai 2008-01-09 15:55:44 +00:00
parent a98a2d4a4e
commit 4a898ae95b
2 changed files with 9 additions and 0 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.30 - Version 2.02.30 -
=================================== ===================================
Print warning when lvm tools are running as non-root.
Add snapshot dmeventd library (enables dmeventd snapshot monitoring). Add snapshot dmeventd library (enables dmeventd snapshot monitoring).
Prevent pvcreate from overwriting MDA-less PVs belonging to active VGs. Prevent pvcreate from overwriting MDA-less PVs belonging to active VGs.
Fix a segfault if using pvs with --all argument. (2.02.29) Fix a segfault if using pvs with --all argument. (2.02.29)

View File

@ -1140,6 +1140,12 @@ static void _exec_lvm1_command(char **argv)
log_sys_error("execvp", path); log_sys_error("execvp", path);
} }
static void _nonroot_warning()
{
if (getuid() || geteuid())
log_warn("WARNING: Running as a non-root user. Functionality may be unavailable.");
}
int lvm2_main(int argc, char **argv, unsigned is_static) int lvm2_main(int argc, char **argv, unsigned is_static)
{ {
char *base; char *base;
@ -1186,6 +1192,7 @@ int lvm2_main(int argc, char **argv, unsigned is_static)
} }
#ifdef READLINE_SUPPORT #ifdef READLINE_SUPPORT
if (!alias && argc == 1) { if (!alias && argc == 1) {
_nonroot_warning();
ret = lvm_shell(cmd, &_cmdline); ret = lvm_shell(cmd, &_cmdline);
goto out; goto out;
} }
@ -1203,6 +1210,7 @@ int lvm2_main(int argc, char **argv, unsigned is_static)
argv++; argv++;
} }
_nonroot_warning();
ret = lvm_run_command(cmd, argc, argv); ret = lvm_run_command(cmd, argc, argv);
if ((ret == ENO_SUCH_CMD) && (!alias)) if ((ret == ENO_SUCH_CMD) && (!alias))
ret = _run_script(cmd, argc, argv); ret = _run_script(cmd, argc, argv);