summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'media-sound/mt-daapd/files/mt-daapd-0.2.3-pidfile.patch')
-rw-r--r--media-sound/mt-daapd/files/mt-daapd-0.2.3-pidfile.patch51
1 files changed, 51 insertions, 0 deletions
diff --git a/media-sound/mt-daapd/files/mt-daapd-0.2.3-pidfile.patch b/media-sound/mt-daapd/files/mt-daapd-0.2.3-pidfile.patch
new file mode 100644
index 000000000000..50ad82cf4f7e
--- /dev/null
+++ b/media-sound/mt-daapd/files/mt-daapd-0.2.3-pidfile.patch
@@ -0,0 +1,51 @@
+Index: mt-daapd-0.2.3/src/main.c
+===================================================================
+--- mt-daapd-0.2.3.orig/src/main.c
++++ mt-daapd-0.2.3/src/main.c
+@@ -551,6 +551,7 @@ void usage(char *program) {
+ printf(" -m Disable mDNS\n");
+ printf(" -c <file> Use configfile specified\n");
+ printf(" -p Parse playlist file\n");
++ printf(" -P <file> Write the PID to specified file\n");
+ printf(" -f Run in foreground\n");
+ printf(" -y Yes, go ahead and run as non-root user\n");
+ printf("\n\n");
+@@ -708,6 +709,7 @@ int start_signal_handler(pthread_t *hand
+ int main(int argc, char *argv[]) {
+ int option;
+ char *configfile=DEFAULT_CONFIGFILE;
++ char *pidfile=PIDFILE;
+ WSCONFIG ws_config;
+ WSHANDLE server;
+ int parseonly=0;
+@@ -726,7 +728,7 @@ int main(int argc, char *argv[]) {
+ config.use_mdns=1;
+ err_debuglevel=1;
+
+- while((option=getopt(argc,argv,"D:d:c:mpfry")) != -1) {
++ while((option=getopt(argc,argv,"D:d:c:mpP:fry")) != -1) {
+ switch(option) {
+ case 'd':
+ err_debuglevel=atoi(optarg);
+@@ -754,6 +756,10 @@ int main(int argc, char *argv[]) {
+ foreground=1;
+ break;
+
++ case 'P':
++ pidfile=optarg;
++ break;
++
+ case 'r':
+ reload=1;
+ break;
+@@ -803,8 +809,8 @@ int main(int argc, char *argv[]) {
+
+ /* open the pidfile, so it can be written once we detach */
+ if((!foreground) && (!force_non_root)) {
+- if(-1 == (pid_fd = open(PIDFILE,O_CREAT | O_WRONLY | O_TRUNC, 0644)))
+- DPRINTF(E_FATAL,L_MAIN,"Error opening pidfile (%s): %s\n",PIDFILE,strerror(errno));
++ if(-1 == (pid_fd = open(pidfile,O_CREAT | O_WRONLY | O_TRUNC, 0644)))
++ DPRINTF(E_FATAL,L_MAIN,"Error opening pidfile (%s): %s\n",pidfile,strerror(errno));
+
+ if(0 == (pid_fp = fdopen(pid_fd, "w")))
+ DPRINTF(E_FATAL,L_MAIN,"fdopen: %s\n",strerror(errno));