aboutsummaryrefslogtreecommitdiffstats
path: root/easydir.c
diff options
context:
space:
mode:
authorJoursoir <chat@joursoir.net>2020-10-28 10:17:47 +0000
committerJoursoir <chat@joursoir.net>2020-10-28 10:17:47 +0000
commitc992bb4c7cc230eff246f5368b7fc765750eec5b (patch)
tree5ac830807bf9698123979e48512af9f4327b305e /easydir.c
parent101dd376b32c2cd12640e81b93c2f30975baac7f (diff)
downloadlock-password-c992bb4c7cc230eff246f5368b7fc765750eec5b.tar.gz
lock-password-c992bb4c7cc230eff246f5368b7fc765750eec5b.tar.bz2
lock-password-c992bb4c7cc230eff246f5368b7fc765750eec5b.zip
feature: move command
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);