Skip to content
Snippets Groups Projects
Commit 836e8888 authored by rswindell's avatar rswindell
Browse files

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.
parent 95e02bc3
No related branches found
No related tags found
No related merge requests found
...@@ -694,12 +694,13 @@ int removecase(const char *path) ...@@ -694,12 +694,13 @@ int removecase(const char *path)
} }
*p=0; *p=0;
return(delfiles(inpath,fname)?-1:0); return(delfiles(inpath,fname) >=1 ? 0 : -1);
} }
#endif #endif
/****************************************************************************/ /****************************************************************************/
/* Deletes all files in dir 'path' that match file spec 'spec' */ /* 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) ulong DLLCALL delfiles(const char *inpath, const char *spec)
{ {
...@@ -715,7 +716,7 @@ 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]; lastch=inpath[inpath_len-1];
path=(char *)malloc(inpath_len+1/*Delim*/+strlen(spec)+1/*Terminator*/); path=(char *)malloc(inpath_len+1/*Delim*/+strlen(spec)+1/*Terminator*/);
if(path==NULL) if(path==NULL)
return 0; return -1;
if(!IS_PATH_DELIM(lastch) && lastch) if(!IS_PATH_DELIM(lastch) && lastch)
sprintf(path,"%s%c",inpath,PATH_DELIM); sprintf(path,"%s%c",inpath,PATH_DELIM);
else else
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment