From 19d9d3fe5ffe84d7badf6ab82f88e96d37f4442d Mon Sep 17 00:00:00 2001 From: Doug MacEachern Date: Wed, 14 Dec 2005 02:17:25 +0000 Subject: [PATCH] support recursion in dir_stat (win32) --- src/sigar_fileinfo.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/sigar_fileinfo.c b/src/sigar_fileinfo.c index 0f0752e4..1a4c6ad5 100644 --- a/src/sigar_fileinfo.c +++ b/src/sigar_fileinfo.c @@ -373,6 +373,8 @@ static int dir_stat_get(sigar_t *sigar, sigar_dir_stat_t *dirstats, int recurse) { + int status; + int do_log = SIGAR_LOG_IS_WARN(sigar); char name[SIGAR_PATH_MAX+1]; int len = strlen(dir); int max = sizeof(name)-len-1; @@ -431,6 +433,14 @@ static int dir_stat_get(sigar_t *sigar, break; case SIGAR_FILETYPE_DIR: ++dirstats->subdirs; + if (recurse) { + status = + dir_stat_get(sigar, name, + dirstats, recurse); + if ((status != SIGAR_OK) && do_log) { + DIR_STAT_WARN(); + } + } break; case SIGAR_FILETYPE_LNK: ++dirstats->symlinks;