summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src/glusterd-store.h
diff options
context:
space:
mode:
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-store.h')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-store.h9
1 files changed, 6 insertions, 3 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-store.h b/xlators/mgmt/glusterd/src/glusterd-store.h
index 9d7a6436e3f..8234463e0c5 100644
--- a/xlators/mgmt/glusterd/src/glusterd-store.h
+++ b/xlators/mgmt/glusterd/src/glusterd-store.h
@@ -56,10 +56,13 @@
#define glusterd_for_each_entry(entry, dir) \
do {\
- entry = readdir (dir);\
- while (entry && (!strcmp (entry->d_name, ".") ||\
- !strcmp (entry->d_name, ".."))) {\
+ entry = NULL;\
+ if (dir) {\
entry = readdir (dir);\
+ while (entry && (!strcmp (entry->d_name, ".") ||\
+ !strcmp (entry->d_name, ".."))) {\
+ entry = readdir (dir);\
+ }\
}\
} while (0); \