From fc8766cb837dd28b39b6276c814f958ea2b57113 Mon Sep 17 00:00:00 2001
From: deuce <>
Date: Tue, 20 Feb 2018 21:22:27 +0000
Subject: [PATCH] Handle glob() failure in getdirsize(). --coverity

---
 src/xpdev/dirwrap.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/xpdev/dirwrap.c b/src/xpdev/dirwrap.c
index 13e0d70a4c..e025272db0 100644
--- a/src/xpdev/dirwrap.c
+++ b/src/xpdev/dirwrap.c
@@ -316,7 +316,8 @@ long DLLCALL getdirsize(const char* path, BOOL include_subdirs, BOOL subdir_only
 	SAFECOPY(match,path);
 	backslash(match);
 	SAFECAT(match,ALLFILES);
-	glob(match,GLOB_MARK,NULL,&g);
+	if (glob(match,GLOB_MARK,NULL,&g) != 0)
+		return 0;
 	if(include_subdirs && !subdir_only)
 		count=g.gl_pathc;
 	else
-- 
GitLab