From 7eb828636407545e466d69594a7b75c63587bcf1 Mon Sep 17 00:00:00 2001 From: Doug MacEachern Date: Wed, 14 Dec 2005 01:47:53 +0000 Subject: [PATCH] minor refactor towards recursive dir_stat impl --- src/sigar_fileinfo.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/sigar_fileinfo.c b/src/sigar_fileinfo.c index d2f9a2a2..75c4e1fe 100644 --- a/src/sigar_fileinfo.c +++ b/src/sigar_fileinfo.c @@ -589,9 +589,9 @@ int sigar_link_attrs_get(sigar_t *sigar, } } -int sigar_dir_stat_get(sigar_t *sigar, - const char *dir, - sigar_dir_stat_t *dirstats) +static int dir_stat_get(sigar_t *sigar, + const char *dir, + sigar_dir_stat_t *dirstats) { char name[SIGAR_PATH_MAX+1]; int len = strlen(dir); @@ -608,8 +608,6 @@ int sigar_dir_stat_get(sigar_t *sigar, return errno; } - SIGAR_ZERO(dirstats); - strncpy(name, dir, sizeof(name)); ptr += len; if (name[len] != '/') { @@ -677,4 +675,12 @@ int sigar_dir_stat_get(sigar_t *sigar, return SIGAR_OK; } +int sigar_dir_stat_get(sigar_t *sigar, + const char *dir, + sigar_dir_stat_t *dirstats) +{ + SIGAR_ZERO(dirstats); + return dir_stat_get(sigar, dir, dirstats); +} + #endif