[gparted] Ensure graphical error message displayed when run by non-root user
- From: Curtis Gedak <gedakc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gparted] Ensure graphical error message displayed when run by non-root user
- Date: Sun, 27 Feb 2011 18:42:26 +0000 (UTC)
commit caa7656829bf53c645325a1a3a739d7e428bd0dc
Author: Curtis Gedak <gedakc gmail com>
Date: Sun Feb 27 11:41:40 2011 -0700
Ensure graphical error message displayed when run by non-root user
Ubuntu launchpad bug 696937 - Running gparted as non-root user
displays no graphical error message
https://bugs.launchpad.net/ubuntu/+source/gparted/+bug/696937
gparted.in | 19 ++++++++++++++++++-
1 files changed, 18 insertions(+), 1 deletions(-)
---
diff --git a/gparted.in b/gparted.in
index 8863216..ac4c5c5 100644
--- a/gparted.in
+++ b/gparted.in
@@ -52,6 +52,24 @@ for k in '' `echo "$PATH" | sed 's,:, ,g'`; do
done
#
+# Define base command for executing GParted
+#
+BASE_CMD="@installdir@/gpartedbin $*"
+
+#
+# If no root privileges, then invoke gpartedbin directly
+# so that a graphical warning is displayed.
+# Otherwise udisks, devkit-disks, or hal-lock in the later
+# invocation may prevent gpartedbin from starting and hence
+# the user will not see a graphical warning.
+#
+if test "x`id -u`" != "x0"; then
+ echo "Root privileges are required for running gparted."
+ $BASE_CMD
+ exit 1
+fi
+
+#
# Use both udisks and hal-lock for invocation if both binaries exist and both
# daemons are running.
# Else use udisks if binary exists and daemon is running.
@@ -61,7 +79,6 @@ done
# Otherwise use hal-lock for invocation if binary exists and daemon is running.
# If the above checks fail then simply run gpartedbin.
#
-BASE_CMD="@installdir@/gpartedbin $*"
if test "x$HAVE_UDISKS" = "xyes" && test "x$HAVE_HAL_LOCK" = "xyes"; then
udisks --inhibit -- \
hal-lock --interface org.freedesktop.Hal.Device.Storage --exclusive \
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]