[ostree] ostadmin: Print an error message if run as non-root
- From: Colin Walters <walters src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [ostree] ostadmin: Print an error message if run as non-root
- Date: Mon, 30 Jul 2012 14:31:06 +0000 (UTC)
commit 5284d21f8dc981ce60cbe51db606198e3e97e026
Author: Colin Walters <walters verbum org>
Date: Mon Jul 30 10:29:45 2012 -0400
ostadmin: Print an error message if run as non-root
See https://bugzilla.gnome.org/show_bug.cgi?id=680823
src/ostadmin/ot-admin-main.c | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
---
diff --git a/src/ostadmin/ot-admin-main.c b/src/ostadmin/ot-admin-main.c
index d4d1d5b..52b26f6 100644
--- a/src/ostadmin/ot-admin-main.c
+++ b/src/ostadmin/ot-admin-main.c
@@ -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;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]