aboutsummaryrefslogtreecommitdiffstats
path: root/easydir.c
diff options
context:
space:
mode:
Diffstat (limited to 'easydir.c')
-rw-r--r--easydir.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/easydir.c b/easydir.c
index 9337fe1..162bae7 100644
--- a/easydir.c
+++ b/easydir.c
@@ -31,11 +31,12 @@ int checkFileExist(char *path_to_file)
{
FILE *pFile;
- pFile = fopen(path_to_file, "r");
+ pFile = fopen(path_to_file, "r+"); // r+ so that errno can equal EISDIR
if(pFile == NULL) {
- if(errno == ENOENT) { // file doesn't exist
+ if(errno == ENOENT) // file doesn't exist
return 0;
- }
+ if(errno == EISDIR) // it's directory
+ return 2;
else callError(120);
}
fclose(pFile);