From 836e888833aff383f53a6f6ad59768516be4cd2b Mon Sep 17 00:00:00 2001
From: rswindell <>
Date: Thu, 26 Nov 2015 08:27:19 +0000
Subject: [PATCH] Bug-fix: removecase() was supposed to return 0 upon success,
 but was returning -1 on success and 0 on failure. Luckily, no caller has been
 checking the return value.

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

diff --git a/src/xpdev/dirwrap.c b/src/xpdev/dirwrap.c
index 53bb46aae2..8f1478ea85 100644
--- a/src/xpdev/dirwrap.c
+++ b/src/xpdev/dirwrap.c
@@ -694,12 +694,13 @@ int removecase(const char *path)
 	}
 	*p=0;
 
-	return(delfiles(inpath,fname)?-1:0);
+	return(delfiles(inpath,fname) >=1 ? 0 : -1);
 }
 #endif
 
 /****************************************************************************/
 /* Deletes all files in dir 'path' that match file spec 'spec'              */
+/* Returns number of files deleted or negative on error						*/
 /****************************************************************************/
 ulong DLLCALL delfiles(const char *inpath, const char *spec)
 {
@@ -715,7 +716,7 @@ ulong DLLCALL delfiles(const char *inpath, const char *spec)
 		lastch=inpath[inpath_len-1];
 	path=(char *)malloc(inpath_len+1/*Delim*/+strlen(spec)+1/*Terminator*/);
 	if(path==NULL)
-		return 0;
+		return -1;
 	if(!IS_PATH_DELIM(lastch) && lastch)
 		sprintf(path,"%s%c",inpath,PATH_DELIM);
 	else
-- 
GitLab