Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
af153d34
Commit
af153d34
authored
Jul 23, 2006
by
J. Alexander Treuman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Tidying up code in checkDirectoryDB
git-svn-id:
https://svn.musicpd.org/mpd/trunk@4434
09075e82-0dd4-0310-85a5-a0d7c8717e4f
parent
14eea124
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
19 deletions
+17
-19
directory.c
src/directory.c
+17
-19
No files found.
src/directory.c
View file @
af153d34
...
...
@@ -1021,39 +1021,37 @@ static void sortDirectory(Directory * directory)
int
checkDirectoryDB
()
{
char
*
dbFile
=
getDbFile
();
/**
* Check if the file exists
*/
char
*
dbFile
;
char
*
dirPath
;
char
*
dbPath
;
dbFile
=
getDbFile
();
/* Check if the file exists */
if
(
access
(
dbFile
,
F_OK
))
{
char
*
dirPath
=
NULL
;
char
*
dbPath
=
strdup
(
dbFile
);
dbPath
=
strdup
(
dbFile
);
/**
* If the file doesn't exits, we can't check if we can write it,
* so we are going to try to get the directory path, and see if we can write a file in that
*/
/* If the file doesn't exist, we can't check if we can write
* it, so we are going to try to get the directory path, and
* see if we can write a file in that */
dirPath
=
dirname
(
dbPath
);
/**
* Check if we can write to the directory
*/
/* Check if we can write to the directory */
if
(
access
(
dirPath
,
R_OK
|
W_OK
))
{
ERROR
(
"Can't create db file in
\"
%s
\"
: %s"
,
dirPath
,
ERROR
(
"Can't create db file in
\"
%s
\"
: %s
\n
"
,
dirPath
,
strerror
(
errno
));
free
(
dbPath
);
return
-
1
;
}
free
(
dbPath
);
return
0
;
}
/**
* File exists, now check if we can write it
*/
/* File exists, now check if we can write it */
if
(
access
(
dbFile
,
R_OK
|
W_OK
))
{
ERROR
(
"
db file
\"
%s
\"
cannot be opened for reading/writing: %s
"
,
ERROR
(
"
Can't open db file
\"
%s
\"
for reading/writing: %s
\n
"
,
dbFile
,
strerror
(
errno
));
return
-
1
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment