summaryrefslogtreecommitdiff
path: root/src/music/extmidi.cpp
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2009-04-10 11:03:48 +0000
committerpeter1138 <peter1138@openttd.org>2009-04-10 11:03:48 +0000
commit6bf1a494756aaf38c947ae06863f5ebe89c2614c (patch)
tree77f13324fa57a032679664936a4fcd165e373673 /src/music/extmidi.cpp
parent9acb1dc3f2111af3d20b853e6fe0d8123a9c3374 (diff)
downloadopenttd-6bf1a494756aaf38c947ae06863f5ebe89c2614c.tar.xz
(svn r16012) -Codechange: Code style clean up.
Diffstat (limited to 'src/music/extmidi.cpp')
-rw-r--r--src/music/extmidi.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/music/extmidi.cpp b/src/music/extmidi.cpp
index c3af20140..0bcb1cdd7 100644
--- a/src/music/extmidi.cpp
+++ b/src/music/extmidi.cpp
@@ -52,8 +52,9 @@ void MusicDriver_ExtMidi::StopSong()
bool MusicDriver_ExtMidi::IsSongPlaying()
{
- if (this->pid != -1 && waitpid(this->pid, NULL, WNOHANG) == this->pid)
+ if (this->pid != -1 && waitpid(this->pid, NULL, WNOHANG) == this->pid) {
this->pid = -1;
+ }
if (this->pid == -1 && this->song[0] != '\0') this->DoPlay();
return this->pid != -1;
}
@@ -68,10 +69,8 @@ void MusicDriver_ExtMidi::DoPlay()
this->pid = fork();
switch (this->pid) {
case 0: {
- int d;
-
close(0);
- d = open("/dev/null", O_RDONLY);
+ int d = open("/dev/null", O_RDONLY);
if (d != -1 && dup2(d, 1) != -1 && dup2(d, 2) != -1) {
#if defined(MIDI_ARG)
execlp(this->command, "extmidi", MIDI_ARG, this->song, (char*)0);