From b56548d530a3c6b059906e2bd242e7845434e07b Mon Sep 17 00:00:00 2001 From: Shehjar Tikoo Date: Tue, 10 Aug 2010 02:41:58 +0000 Subject: glusterd: Solaris build fixes Signed-off-by: Shehjar Tikoo Signed-off-by: Anand V. Avati BUG: 1178 (Gluster mainline build fails on Solaris) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1178 --- xlators/mgmt/glusterd/src/glusterd-store.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'xlators/mgmt/glusterd/src/glusterd-store.c') diff --git a/xlators/mgmt/glusterd/src/glusterd-store.c b/xlators/mgmt/glusterd/src/glusterd-store.c index 8d66fe6f..88a8140d 100644 --- a/xlators/mgmt/glusterd/src/glusterd-store.c +++ b/xlators/mgmt/glusterd/src/glusterd-store.c @@ -330,6 +330,7 @@ glusterd_store_delete_volume (glusterd_volinfo_t *volinfo) DIR *dir = NULL; struct dirent *entry = NULL; char path[PATH_MAX] = {0,}; + struct stat st = {0, }; GF_ASSERT (volinfo); priv = THIS->private; @@ -351,7 +352,14 @@ glusterd_store_delete_volume (glusterd_volinfo_t *volinfo) while (entry) { snprintf (path, PATH_MAX, "%s/%s", pathname, entry->d_name); - if (DT_DIR == entry->d_type) + ret = stat (path, &st); + if (ret == -1) { + gf_log ("", GF_LOG_ERROR, "Failed to stat entry: %s:%s", + path, strerror (errno)); + goto stat_failed; + } + + if (S_ISDIR (st.st_mode)) ret = rmdir (path); else ret = unlink (path); @@ -361,6 +369,7 @@ glusterd_store_delete_volume (glusterd_volinfo_t *volinfo) entry->d_name); if (ret) gf_log ("", GF_LOG_NORMAL, "errno:%d", errno); +stat_failed: memset (path, 0, sizeof(path)); glusterd_for_each_entry (entry, dir); } -- cgit