vss.c: Don't try to mmap empty files
authorAndre Noll <maan@systemlinux.org>
Thu, 22 Mar 2007 15:15:42 +0000 (16:15 +0100)
committerAndre Noll <maan@systemlinux.org>
Thu, 22 Mar 2007 15:15:42 +0000 (16:15 +0100)
as this causes mmap() to return MAP_FAILED, i.e. para_mmap() calls
exit() so para_server dies, which clearly is inapproriate.  Instead,
skip the audio file and try the next one if size == 0.

vss.c

diff --git a/vss.c b/vss.c
index 8e9c17b..cb2d16c 100644 (file)
--- a/vss.c
+++ b/vss.c
@@ -268,7 +268,8 @@ static void vss_get_audio_file(void)
                audio_file = open(sl[i], O_RDONLY);
                if (audio_file < 0)
                        continue;
-               if (fstat(audio_file, &file_status) == -1) {
+               if (fstat(audio_file, &file_status) == -1 ||
+                               !file_status.st_size) {
                        close(audio_file);
                        continue;
                }