From 4c9c70d697ed728362a1cc74c35c0f76e3caf909 Mon Sep 17 00:00:00 2001 From: Curtis Gedak Date: Tue, 11 Jun 2013 13:09:18 -0600 Subject: [PATCH] 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 file changed, 14 insertions(+), 3 deletions(-) diff --git a/gparted.in b/gparted.in index 7cf8433a..32360877 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 # @@ -25,6 +27,15 @@ # along with GParted. If not, see . # +# +# 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.