diff options
author | tron <tron@openttd.org> | 2005-09-12 09:53:56 +0000 |
---|---|---|
committer | tron <tron@openttd.org> | 2005-09-12 09:53:56 +0000 |
commit | b84e36d717a706d11d8e59812bd17eced6b5bb52 (patch) | |
tree | e648bb33c8df758a87e96c4473c70360b62d356a /music | |
parent | 02472528ad792238f03d28e907115030227bc5bc (diff) | |
download | openttd-b84e36d717a706d11d8e59812bd17eced6b5bb52.tar.xz |
(svn r2946) Remove redundant calls, simplify a check and terminate the argument list of execlp() as suggested by the manpage to make it correctly work on 64bit platforms
Diffstat (limited to 'music')
-rw-r--r-- | music/extmidi.c | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/music/extmidi.c b/music/extmidi.c index 9bd946f4e..d474b3acb 100644 --- a/music/extmidi.c +++ b/music/extmidi.c @@ -69,17 +69,13 @@ static void DoPlay(void) int d; close(0); - close(1); - close(2); d = open("/dev/null", O_RDONLY); - if (d != -1) { - if (dup2(d, 1) != -1 && dup2(d, 2) != -1) { - #if defined(MIDI_ARG) - execlp(msf.extmidi, "extmidi", MIDI_ARG, _midi.song, NULL); - #else - execlp(msf.extmidi, "extmidi", _midi.song, NULL); - #endif - } + if (d != -1 && dup2(d, 1) != -1 && dup2(d, 2) != -1) { + #if defined(MIDI_ARG) + execlp(msf.extmidi, "extmidi", MIDI_ARG, _midi.song, (char*)0); + #else + execlp(msf.extmidi, "extmidi", _midi.song, (char*)0); + #endif } _exit(1); } |