ostadmin: Print an error message if run as non-root

See https://bugzilla.gnome.org/show_bug.cgi?id=680823
This commit is contained in:
Colin Walters 2012-07-30 10:29:45 -04:00
parent a179138a23
commit 5284d21f8d

View File

@ -100,6 +100,13 @@ ot_admin_main (int argc,
if (argc < 2)
return usage (argv, builtins, 1);
if (geteuid () != 0)
{
g_set_error (&error, G_IO_ERROR, G_IO_ERROR_FAILED,
"ostadmin: Can only be run as root");
goto out;
}
cmd = argv[1];
builtin = builtins;