summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-store.c11
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-utils.c6
2 files changed, 15 insertions, 2 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-store.c b/xlators/mgmt/glusterd/src/glusterd-store.c
index 8d66fe6feaa..88a8140d10e 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);
}
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c
index 5ef0ce1e5c1..be8c95b584e 100644
--- a/xlators/mgmt/glusterd/src/glusterd-utils.c
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.c
@@ -48,6 +48,10 @@
#include <sys/ioctl.h>
#include <sys/socket.h>
+#ifdef GF_SOLARIS_HOST_OS
+#include <sys/sockio.h>
+#endif
+
static glusterd_lock_t lock;
static int32_t
@@ -119,7 +123,7 @@ glusterd_is_local_addr (char *hostname)
int32_t num_req = 0;
struct sockaddr_in sa = {0,};
- sd = socket (AF_LOCAL, SOCK_DGRAM, 0);
+ sd = socket (PF_UNIX, SOCK_DGRAM, 0);
if (sd == -1)
goto out;