[GRASS-SVN] r39256 - grass/branches/releasebranch_6_4/lib/init

svn_grass at osgeo.org svn_grass at osgeo.org
Sat Sep 19 17:06:58 EDT 2009


Author: hamish
Date: 2009-09-19 17:06:57 -0400 (Sat, 19 Sep 2009)
New Revision: 39256

Modified:
   grass/branches/releasebranch_6_4/lib/init/init.sh
   grass/branches/releasebranch_6_4/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/releasebranch_6_4/lib/init/init.sh
===================================================================
--- grass/branches/releasebranch_6_4/lib/init/init.sh	2009-09-19 21:04:34 UTC (rev 39255)
+++ grass/branches/releasebranch_6_4/lib/init/init.sh	2009-09-19 21:06:57 UTC (rev 39256)
@@ -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/releasebranch_6_4/lib/init/lock.c
===================================================================
--- grass/branches/releasebranch_6_4/lib/init/lock.c	2009-09-19 21:04:34 UTC (rev 39255)
+++ grass/branches/releasebranch_6_4/lib/init/lock.c	2009-09-19 21:06:57 UTC (rev 39256)
@@ -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