ALT Linux repositórios
Group :: Som
RPM: TiMidity++
Main Changelog Spec Patches Sources Download Gear Bugs e FR Repocop
Patch: TiMidity++-deb-don-t-crash-when-started-in-daemon-mode.patch
Download
Download
From 45914850b9ce3b8a73d8d0bc30307f4247b5f0ed Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Tue, 26 Jun 2018 22:31:20 +0200
Subject: [PATCH 3/8] Don't crash when started in daemon mode
Bug-Debian: https://bugs.debian.org/545476
Bug-Fedora: https://bugzilla.redhat.com/show_bug.cgi?id=501051
---
TiMidity++/timidity/timidity.c | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
diff --git a/TiMidity++/timidity/timidity.c b/TiMidity++/timidity/timidity.c
index e92865c..c685ec9 100644
--- a/TiMidity++/timidity/timidity.c
+++ b/TiMidity++/timidity/timidity.c
@@ -5605,6 +5605,29 @@ MAIN_INTERFACE int timidity_post_load_configuration(void)
}
#endif
+ /* If we're going to fork for daemon mode, we need to fork now, as
+ certain output libraries (pulseaudio) become unhappy if initialized
+ before forking and then being used from the child. */
+ if (ctl->id_character == 'A' && (ctl->flags & CTLF_DAEMONIZE))
+ {
+ int pid = fork();
+ FILE *pidf;
+ switch (pid)
+ {
+ case 0: // child is the daemon
+ break;
+ case -1: // error status return
+ exit(7);
+ default: // no error, doing well
+ if ((pidf = fopen( "/var/run/timidity/timidity.pid", "w" )) != NULL )
+ {
+ fprintf( pidf, "%d\n", pid );
+ fclose( pidf );
+ }
+ exit(0);
+ }
+ }
+
if(play_mode == &null_play_mode)
{
char *output_id;
--
2.21.0