[GRASS-SVN] r63940 - grass/trunk/general/g.version

svn_grass at osgeo.org svn_grass at osgeo.org
Sat Jan 3 04:38:51 PST 2015


Author: martinl
Date: 2015-01-03 04:38:51 -0800 (Sat, 03 Jan 2015)
New Revision: 63940

Modified:
   grass/trunk/general/g.version/main.c
Log:
g.version: fix segfault on unknown svn revision/date 


Modified: grass/trunk/general/g.version/main.c
===================================================================
--- grass/trunk/general/g.version/main.c	2015-01-03 04:43:23 UTC (rev 63939)
+++ grass/trunk/general/g.version/main.c	2015-01-03 12:38:51 UTC (rev 63940)
@@ -125,11 +125,13 @@
 	/* if number of tokes is right, print it */
 	if (G_number_of_tokens(rev_ver) == tokens_expected &&
 	    G_number_of_tokens(rev_time) == tokens_expected) {
+            char *p;
+            p = strstr(rev_ver[1], " ");
 	    if (shell->answer) {
 		fprintf(stdout, "libgis_revision=%s\n",
-			strstr(rev_ver[1], " ") + 1);
+			p ? p + 1 : "00000");
 		fprintf(stdout, "libgis_date=\"%s\"\n",
-			strstr(rev_time[1], " ") + 1);
+			p ? strstr(rev_time[1], " ") + 1 : "?");
 	    }
 	    else {
 		fprintf(stdout, "libgis %s\nlibgis %s\n", rev_ver[1],



More information about the grass-commit mailing list