diff options
author | Qball Cow <qball@qballcow.nl> | 2006-05-08 21:03:47 +0000 |
---|---|---|
committer | Qball Cow <qball@qballcow.nl> | 2006-05-08 21:03:47 +0000 |
commit | 66e4379d698172fe7c3f17799eb24628df79bffa (patch) | |
tree | 1d820388945c7e31c1cf1366afa072eff468f9ac /src/directory.c | |
parent | 1071524ae7b482d90d394cb8d9f13104f0eefedb (diff) | |
download | mpd-66e4379d698172fe7c3f17799eb24628df79bffa.tar.gz mpd-66e4379d698172fe7c3f17799eb24628df79bffa.tar.xz mpd-66e4379d698172fe7c3f17799eb24628df79bffa.zip |
Jat/Q patch for checking permission on database before creating it
git-svn-id: https://svn.musicpd.org/mpd/trunk@4140 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to '')
-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(); |