[mcstrans] Update to upstream

Daniel J Walsh dwalsh at fedoraproject.org
Wed Feb 1 22:05:05 UTC 2012


commit 5c58719d6f18c8b693061d46b4496e4fadd53812
Author: Dan Walsh <dwalsh at redhat.com>
Date:   Wed Feb 1 17:05:02 2012 -0500

    Update to upstream
    
    - Write pid file

 master/mcstrans-0.3.2-writepid.patch |   51 ++++++++++++++++++++++++++++++++++
 1 files changed, 51 insertions(+), 0 deletions(-)
---
diff --git a/master/mcstrans-0.3.2-writepid.patch b/master/mcstrans-0.3.2-writepid.patch
new file mode 100644
index 0000000..927782a
--- /dev/null
+++ b/master/mcstrans-0.3.2-writepid.patch
@@ -0,0 +1,51 @@
+diff -up mcstrans-0.3.2/src/mcstransd.c.writepid mcstrans-0.3.2/src/mcstransd.c
+--- mcstrans-0.3.2/src/mcstransd.c.writepid	2011-01-05 10:32:25.000000000 -0500
++++ mcstrans-0.3.2/src/mcstransd.c	2012-02-01 16:14:02.085806490 -0500
+@@ -4,6 +4,7 @@
+ #include <sys/socket.h>
+ #include <sys/poll.h>
+ #include <sys/stat.h>
++#include <fcntl.h>
+ #include <sys/un.h>
+ #include <errno.h>
+ #include <stdint.h>
+@@ -556,6 +557,30 @@ void dropprivs(void)
+ 	cap_free(new_caps);
+ }
+ 
++static const char *pidfile = "/var/run/mcstransd.pid";
++
++static int write_pid_file(void)
++{
++	int pidfd, len;
++	char val[16];
++
++	len = snprintf(val, sizeof(val), "%u\n", getpid());
++	if (len < 0) {
++		syslog(LOG_ERR, "Pid error (%s)", strerror(errno));
++		pidfile = 0;
++		return 1;
++	}
++	pidfd = open(pidfile, O_CREAT | O_TRUNC | O_NOFOLLOW | O_WRONLY, 0644);
++	if (pidfd < 0) {
++		syslog(LOG_ERR, "Unable to set pidfile (%s)", strerror(errno));
++		pidfile = 0;
++		return 1;
++	}
++	(void)write(pidfd, val, (unsigned int)len);
++	close(pidfd);
++	return 0;
++}
++
+ int
+ main(int UNUSED(argc), char *argv[])
+ {
+@@ -582,6 +607,8 @@ main(int UNUSED(argc), char *argv[])
+ 	}
+ #endif
+ 
++	write_pid_file();
++
+ 	syslog(LOG_NOTICE, "%s initialized", argv[0]);
+ 	process_connections();
+ 


More information about the scm-commits mailing list