Changeset - r2420:9c6b59cfb951
[Not reviewed]
master
0 1 0
tron - 19 years ago 2005-09-12 09:53:56
tron@openttd.org
(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
1 file changed with 6 insertions and 10 deletions:
0 comments (0 inline, 0 general)
music/extmidi.c
Show inline comments
 
@@ -66,23 +66,19 @@ static void DoPlay(void)
 
	_midi.pid = fork();
 
	switch (_midi.pid) {
 
		case 0: {
 
			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);
 
		}
 

	
 
		case -1:
 
			fprintf(stderr, "extmidi: couldn't fork: %s\n", strerror(errno));
0 comments (0 inline, 0 general)