[gparted] Only permit one instance of GParted to execute at a time



commit 4c9c70d697ed728362a1cc74c35c0f76e3caf909
Author: Curtis Gedak <gedakc gmail com>
Date:   Tue Jun 11 13:09:18 2013 -0600

    Only permit one instance of GParted to execute at a time
    
    Only one partition editing tool should be in use at any one point
    in time.  If more than one is in use concurrently, then data loss
    might occur through operations on common partitions or partition
    tables.  As such, prevent multiple copies of GParted from running
    at the same time.

 gparted.in |   17 ++++++++++++++---
 1 files changed, 14 insertions(+), 3 deletions(-)
---
diff --git a/gparted.in b/gparted.in
index 7cf8433..3236087 100644
--- a/gparted.in
+++ b/gparted.in
@@ -3,9 +3,11 @@
 #  Purpose:  Perform appropriate startup of GParted executable gpartedbin.
 #
 #            The purpose of these startup methods is to prevent
-#            devices from being automounted.
-#            File system problems can occur if devices are mounted
-#            prior to the completion of GParted's operations.
+#            devices from being automounted, and to ensure only one
+#            instance of GParted is running.  File system problems can
+#            occur if devices are mounted prior to the completion of
+#            GParted's operations, or if multiple partition editing
+#            tools are in use concurrently.
 #
 # Copyright (C) 2008, 2009, 2010, 2013 Curtis Gedak
 #
@@ -26,6 +28,15 @@
 #
 
 #
+#  Only permit one instance of GParted to execute at a time
+#
+if test "z`ps -e | grep gpartedbin`" != "z"; then
+       echo "The process gpartedbin is already running."
+       echo "Only one gpartedbin process is permitted."
+       exit 1
+fi
+
+#
 #  Search PATH to determine if systemctl program can be found
 #  and if appropriate daemon is running.
 #


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]