aboutsummaryrefslogtreecommitdiffstats
path: root/src/directory.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-09-07 13:48:37 +0200
committerMax Kellermann <max@duempel.org>2008-09-07 13:48:37 +0200
commitf320c9fa1dc2268fbd97ba9cb00140276c0a2e23 (patch)
treebd4102bc4a1d6914777305bf73690f3a8c5c7fa0 /src/directory.c
parent528be8a0a9b8f9978b3968ab855e69a7ec2935d4 (diff)
downloadmpd-f320c9fa1dc2268fbd97ba9cb00140276c0a2e23.tar.gz
mpd-f320c9fa1dc2268fbd97ba9cb00140276c0a2e23.tar.xz
mpd-f320c9fa1dc2268fbd97ba9cb00140276c0a2e23.zip
directory: don't pass fd to traverseAllIn()
This patch continues the work of the previous patch: don't pass a file descriptor at all to traverseAllIn(). Since this fd was only used to report "directory not found" errors, we can easily move that check to the caller. This is a great relief, since it removes the dependency on a client connection from a lot of enumeration functions.
Diffstat (limited to '')
-rw-r--r--src/directory.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/directory.c b/src/directory.c
index 23c2d274f..d72aca1de 100644
--- a/src/directory.c
+++ b/src/directory.c
@@ -1155,8 +1155,8 @@ int readDirectoryDB(void)
readDirectoryInfo(fp, mp3rootDirectory);
while (fclose(fp) && errno == EINTR) ;
- stats.numberOfSongs = countSongsIn(STDERR_FILENO, NULL);
- stats.dbPlayTime = sumSongTimesIn(STDERR_FILENO, NULL);
+ stats.numberOfSongs = countSongsIn(NULL);
+ stats.dbPlayTime = sumSongTimesIn(NULL);
if (stat(dbFile, &st) == 0)
directory_dbModTime = st.st_mtime;
@@ -1220,7 +1220,7 @@ static int traverseAllInSubDirectory(Directory * directory,
return errFlag;
}
-int traverseAllIn(int fd, const char *name,
+int traverseAllIn(const char *name,
int (*forEachSong) (Song *, void *),
int (*forEachDir) (Directory *, void *), void *data)
{
@@ -1231,8 +1231,6 @@ int traverseAllIn(int fd, const char *name,
if ((song = getSongFromDB(name)) && forEachSong) {
return forEachSong(song, data);
}
- commandError(fd, ACK_ERROR_NO_EXIST,
- "directory or file not found");
return -1;
}
@@ -1257,8 +1255,8 @@ void initMp3Directory(void)
mp3rootDirectory = newDirectory(NULL, NULL);
exploreDirectory(mp3rootDirectory);
freeAllDirectoryStats(mp3rootDirectory);
- stats.numberOfSongs = countSongsIn(STDERR_FILENO, NULL);
- stats.dbPlayTime = sumSongTimesIn(STDERR_FILENO, NULL);
+ stats.numberOfSongs = countSongsIn(NULL);
+ stats.dbPlayTime = sumSongTimesIn(NULL);
}
static Song *getSongDetails(const char *file, const char **shortnameRet,