aboutsummaryrefslogtreecommitdiffstats
path: root/src/directory.c
diff options
context:
space:
mode:
authorWarren Dukes <warren.dukes@gmail.com>2004-04-13 19:24:05 +0000
committerWarren Dukes <warren.dukes@gmail.com>2004-04-13 19:24:05 +0000
commitb5bdc71d2c2041e9db7c461f5e15897b7e5c4be2 (patch)
tree7ab68fa9b8acbe46badb7c5081c02d9ca73e32d3 /src/directory.c
parent860f8bda714da8724777e47829e751585b4ca288 (diff)
downloadmpd-b5bdc71d2c2041e9db7c461f5e15897b7e5c4be2.tar.gz
mpd-b5bdc71d2c2041e9db7c461f5e15897b7e5c4be2.tar.xz
mpd-b5bdc71d2c2041e9db7c461f5e15897b7e5c4be2.zip
have update process ignore signals when writing db
git-svn-id: https://svn.musicpd.org/mpd/trunk@735 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to '')
-rw-r--r--src/directory.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/directory.c b/src/directory.c
index 8f2765d26..370744aae 100644
--- a/src/directory.c
+++ b/src/directory.c
@@ -150,6 +150,8 @@ int updateInit(FILE * fp, List * pathList) {
directory_updatePid = fork();
if(directory_updatePid==0) {
/* child */
+ struct sigaction sa;
+
clearPlayerPid();
unblockSignals();
@@ -186,6 +188,8 @@ int updateInit(FILE * fp, List * pathList) {
}
}
else if(updateDirectory(mp3rootDirectory)<0) exit(EXIT_FAILURE);
+ /* ignore signals since we don't want them to corrupt the db*/
+ ignoreSignals();
if(writeDirectoryDB()<0) {
ERROR("problems writing music db file, \"%s\"\n",
directorydb);
@@ -684,6 +688,7 @@ int writeDirectoryDB() {
while(!(fp=fopen(directorydb,"w")) && errno==EINTR);
if(!fp) return -1;
+ /* block signals when writing the db so we don't get a corrupted db*/
myfprintf(fp,"%s\n",DIRECTORY_INFO_BEGIN);
myfprintf(fp,"%s%s\n",DIRECTORY_MPD_VERSION,VERSION);
myfprintf(fp,"%s%s\n",DIRECTORY_FS_CHARSET,getFsCharset());