Explorar o código

d.mon: Fix d.mon -l/stop

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@65053 15284696-431f-4ddb-bdfa-cd5b030d7da7
Huidae Cho %!s(int64=10) %!d(string=hai) anos
pai
achega
915053285d
Modificáronse 1 ficheiros con 11 adicións e 2 borrados
  1. 11 2
      display/d.mon/list.c

+ 11 - 2
display/d.mon/list.c

@@ -50,10 +50,19 @@ void list_mon(char ***list, int *n)
         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)++;
     }