[GRASS-SVN] r38762 - grass/trunk/raster/r.li/r.li.daemon

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Aug 17 01:44:34 EDT 2009


Author: hamish
Date: 2009-08-17 01:44:32 -0400 (Mon, 17 Aug 2009)
New Revision: 38762

Modified:
   grass/trunk/raster/r.li/r.li.daemon/daemon.c
Log:
use G_home(), output text file as umask 0644 (merge from devbr6)

Modified: grass/trunk/raster/r.li/r.li.daemon/daemon.c
===================================================================
--- grass/trunk/raster/r.li/r.li.daemon/daemon.c	2009-08-17 05:44:31 UTC (rev 38761)
+++ grass/trunk/raster/r.li/r.li.daemon/daemon.c	2009-08-17 05:44:32 UTC (rev 38762)
@@ -102,8 +102,9 @@
        ######################################################### */
 
     /* TODO: check if this path is portable */
-    sprintf(pathSetup, "%s/.grass7/r.li/%s", getenv("HOME"), file);
-    G_debug(1, "r.li.daemon pathSetup: %s", pathSetup);
+/* TODO: use G_rc_path() */
+    sprintf(pathSetup, "%s/.grass7/r.li/%s", G_home(), file);
+    G_debug(1, "r.li.daemon pathSetup: [%s]", pathSetup);
     parsed = parseSetup(pathSetup, l, g, raster);
 
     /*########################################################
@@ -124,20 +125,28 @@
 	    G_fatal_error(_("Cannot create random access file"));
     }
     else {
-	/*check if ~/.r.li/output exist */
-	sprintf(out, "%s/.r.li/", getenv("HOME"));
+	/* check if ~/.grass7/ exists */
+	sprintf(out, "%s/.grass7/", G_home());
+	doneDir = G_mkdir(out);
+	if (doneDir == -1 && errno != EEXIST)
+	    G_fatal_error(_("Cannot create %s/.grass7/ directory"),
+			  G_home());
 
+	/* check if ~/.grass7/r.li/ exists */
+	sprintf(out, "%s/.grass7/r.li/", G_home());
 	doneDir = G_mkdir(out);
 	if (doneDir == -1 && errno != EEXIST)
-	    G_fatal_error(_("Cannot create %s/.r.li/ directory"),
-			  getenv("HOME"));
-	sprintf(out, "%s/.r.li/output", getenv("HOME"));
+	    G_fatal_error(_("Cannot create %s/.grass7/r.li/ directory"),
+			  G_home());
+
+	/* check if ~/.grass7/r.li/output exists */
+	sprintf(out, "%s/.grass7/r.li/output", G_home());
 	doneDir = G_mkdir(out);
 	if (doneDir == -1 && errno != EEXIST)
-	    G_fatal_error(_("Cannot create %s/.r.li/output/ directory"),
-			  getenv("HOME"));
-	sprintf(out, "%s/.r.li/output/%s", getenv("HOME"), output);
-	res = open(out, O_WRONLY | O_CREAT | O_TRUNC, 0755);
+	    G_fatal_error(_("Cannot create %s/.grass7/r.li/output/ directory"),
+			  G_home());
+	sprintf(out, "%s/.grass7/r.li/output/%s", G_home(), output);
+	res = open(out, O_WRONLY | O_CREAT | O_TRUNC, 0644);
     }
     i = 0;
 



More information about the grass-commit mailing list