浏览代码

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 10 年之前
父节点
当前提交
915053285d
共有 1 个文件被更改,包括 11 次插入2 次删除
  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)++;
     }