From 963294520ef34cdc288fae9704d5c1e2f16724f8 Mon Sep 17 00:00:00 2001 From: Honza HorĂ¡k Date: Sep 25 2012 10:46:27 +0000 Subject: add rusers-0.17-sdnotify.patch --- diff --git a/rusers-0.17-sdnotify.patch b/rusers-0.17-sdnotify.patch new file mode 100644 index 0000000..f736583 --- /dev/null +++ b/rusers-0.17-sdnotify.patch @@ -0,0 +1,75 @@ +diff -up netkit-rusers-0.17/rpc.rstatd/rstatd.c.sdnotify netkit-rusers-0.17/rpc.rstatd/rstatd.c +--- netkit-rusers-0.17/rpc.rstatd/rstatd.c.sdnotify 2012-09-24 15:57:11.080034637 +0200 ++++ netkit-rusers-0.17/rpc.rstatd/rstatd.c 2012-09-24 15:57:11.131034735 +0200 +@@ -42,6 +42,7 @@ static char rcsid[] = "$Id: rstatd.c,v 1 + #include + #include + #include ++#include + + extern void rstat_service(); + +@@ -113,6 +114,26 @@ main(int argc, char *argv[]) + exit(1); + } + ++ /* If we use systemd as an init system, we may want to give it ++ a message, that this daemon is ready to accept connections. ++ At this time, sockets for receiving connections are already ++ created, so we can say we're ready now. It is a nop if we ++ don't use systemd. */ ++ { ++ int result; ++ ++ result = sd_notifyf(0, "READY=1\n" ++ "STATUS=Processing requests...\n" ++ "MAINPID=%lu", (unsigned long) getpid()); ++ ++ /* Return code from sd_notifyf can be ignored, as per sd_notifyf(3). ++ However, if we use systemd's native unit file, we need to send ++ this message to let systemd know that daemon is ready. ++ Thus, we want to know that the call had some issues. */ ++ if (result < 0) ++ syslog(LOG_ERR, "sd_notifyf failed: %s\n", strerror(-result)); ++ } ++ + svc_run(); + syslog(LOG_ERR, "svc_run returned"); + exit(1); +diff -up netkit-rusers-0.17/rpc.rusersd/rusersd.c.sdnotify netkit-rusers-0.17/rpc.rusersd/rusersd.c +--- netkit-rusers-0.17/rpc.rusersd/rusersd.c.sdnotify 2012-09-24 15:57:11.123034720 +0200 ++++ netkit-rusers-0.17/rpc.rusersd/rusersd.c 2012-09-24 15:57:11.133034738 +0200 +@@ -38,6 +38,7 @@ char rusersd_rcsid[] = + #include + #include + #include ++#include + #ifdef __GLIBC__ + #include + #else +@@ -128,6 +129,25 @@ main(void) + } + } + ++ /* If we use systemd as an init system, we may want to give it ++ a message, that this daemon is ready to accept connections. ++ At this time, sockets for receiving connections are already ++ created, so we can say we're ready now. It is a nop if we ++ don't use systemd. */ ++ { ++ int result; ++ ++ result = sd_notifyf(0, "READY=1\n" ++ "STATUS=Processing requests...\n" ++ "MAINPID=%lu", (unsigned long) getpid()); ++ ++ /* Return code from sd_notifyf can be ignored, as per sd_notifyf(3). ++ However, if we use systemd's native unit file, we need to send ++ this message to let systemd know that daemon is ready. ++ Thus, we want to know that the call had some issues. */ ++ if (result < 0) ++ syslog(LOG_ERR, "sd_notifyf failed: %s\n", strerror(-result)); ++ } + + svc_run(); + syslog(LOG_ERR, "svc_run returned");