[GRASS-SVN] r39255 - grass/branches/develbranch_6/lib/init

svn_grass at osgeo.org svn_grass at osgeo.org
Sat Sep 19 17:04:35 EDT 2009


Author: hamish
Date: 2009-09-19 17:04:34 -0400 (Sat, 19 Sep 2009)
New Revision: 39255

Modified:
   grass/branches/develbranch_6/lib/init/init.sh
   grass/branches/develbranch_6/lib/init/lock.c
Log:
move lockfile detection to exit(2) to allow G_fatal_error() to occupy exit(1) alone (trac #755; merge from trunk)

Modified: grass/branches/develbranch_6/lib/init/init.sh
===================================================================
--- grass/branches/develbranch_6/lib/init/init.sh	2009-09-19 19:30:45 UTC (rev 39254)
+++ grass/branches/develbranch_6/lib/init/init.sh	2009-09-19 21:04:34 UTC (rev 39255)
@@ -731,7 +731,7 @@
 "$ETC/lock" "$lockfile" $$
 case $? in
     0) ;;
-    1)
+    2)
     	echo "$USER is currently running GRASS in selected mapset (file $lockfile found). Concurrent use not allowed."
     	cleanup_tmp
     	exit 1 ;;

Modified: grass/branches/develbranch_6/lib/init/lock.c
===================================================================
--- grass/branches/develbranch_6/lib/init/lock.c	2009-09-19 19:30:45 UTC (rev 39254)
+++ grass/branches/develbranch_6/lib/init/lock.c	2009-09-19 21:04:34 UTC (rev 39255)
@@ -15,8 +15,9 @@
 *
 *   1. if file exists, the pid is read out of the file. if this
 *      process is still running, the file is considered locked.
-*      exit(1)
-*   2. if file does not exist, or if file exists but process is not
+*      exit(2).
+*   2. something weird happened. G_fatal_error() aka exit(1)
+*   3. if file does not exist, or if file exists but process is not
 *      running (ie, lock was not removed), the file is locked for
 *      process pid by writing pid into the file.
 *      exit(0).
@@ -49,7 +50,7 @@
 	close(lock);
     }
     if (locked)
-	exit(1);
+	exit(2);
 
     if ((lock = creat(file, 0666)) < 0) {
 	perror(file);



More information about the grass-commit mailing list