[GRASS-SVN] r65053 - grass/trunk/display/d.mon

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Apr 14 12:41:44 PDT 2015


Author: hcho
Date: 2015-04-14 12:41:44 -0700 (Tue, 14 Apr 2015)
New Revision: 65053

Modified:
   grass/trunk/display/d.mon/list.c
Log:
d.mon: Fix d.mon -l/stop

Modified: grass/trunk/display/d.mon/list.c
===================================================================
--- grass/trunk/display/d.mon/list.c	2015-04-11 10:53:01 UTC (rev 65052)
+++ grass/trunk/display/d.mon/list.c	2015-04-14 19:41:44 UTC (rev 65053)
@@ -50,10 +50,19 @@
         return;
 
     while ((dp = readdir(dirp)) != NULL) {
+	int ret;
+
         *list = G_realloc(*list, (*n + 1) * sizeof(char *));
-        stat(dp->d_name, &s);
-        if (!dp->d_name || dp->d_name[0] == '.' || !S_ISDIR(s.st_mode))
+        if (!dp->d_name || dp->d_name[0] == '.')
+	    continue;
+
+	mon_path = get_path(dp->d_name, TRUE);
+        ret = G_stat(mon_path, &s);
+	G_free(mon_path);
+
+        if (ret != 0 || !S_ISDIR(s.st_mode))
             continue;
+
         (*list)[*n] = dp->d_name;
         (*n)++;
     }



More information about the grass-commit mailing list