diff options
Diffstat (limited to 'src/directory.c')
-rw-r--r-- | src/directory.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/directory.c b/src/directory.c index 891e7c351..8e1904794 100644 --- a/src/directory.c +++ b/src/directory.c @@ -988,6 +988,18 @@ void sortDirectory(Directory * directory) { } } +int checkDirectoryDB() { + char * dbFile = getDbFile(); + + if(access(dbFile, R_OK|W_OK)) { + ERROR("db file \"%s\" cannot be opened for reading/writing: %s", + dbFile, strerror(errno)); + return -1; + } + + return 0; +} + int writeDirectoryDB() { FILE * fp; char * dbFile = getDbFile(); |