diff --git a/src/xpdev/dirwrap.c b/src/xpdev/dirwrap.c
index 53bb46aae22b1be406466b5669407acd7f544c94..8f1478ea858474bc9e5461334ef99e7910d4548d 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