Sisyphus repository
Last update: 1 october 2023 | SRPMs: 18631 | Visits: 37696755
en ru br
ALT Linux repos
S:2.8.0-alt2
5.0: 2.0.5-alt3.1
4.1: 2.0.5-alt3
4.0: 2.0.5-alt2
3.0: 2.0.2-alt1

Group :: System/Servers
RPM: nut

 Main   Changelog   Spec   Patches   Sources   Download   Gear   Bugs and FR  Repocop 

Patch: nut-2.8.0-rmpidf.patch
Download


diff -up nut-2.7.1/clients/upsmon.c.rmpidf nut-2.7.1/clients/upsmon.c
--- nut-2.7.1/clients/upsmon.c.rmpidf	2014-02-27 11:41:09.139369295 +0100
+++ nut-2.7.1/clients/upsmon.c	2014-02-27 11:41:09.145369344 +0100
@@ -2027,6 +2027,7 @@ int main(int argc, char *argv[])
 
 	upslogx(LOG_INFO, "Signal %d: exiting", exit_flag);
 	upsmon_cleanup();
+	cleanpid(prog);
 
 	exit(EXIT_SUCCESS);
 }
diff -up nut-2.7.1/common/common.c.rmpidf nut-2.7.1/common/common.c
--- nut-2.7.1/common/common.c.rmpidf	2013-11-20 20:53:31.000000000 +0100
+++ nut-2.7.1/common/common.c	2014-02-27 11:41:09.146369353 +0100
@@ -229,6 +229,20 @@ void writepid(const char *name)
 	return pid;
 }
 
+/* remove pid file */
+void cleanpid(const char *name)
+{
+	char	fn[SMALLBUF];
+
+	/* use full path if present, else build filename in PIDPATH */
+	if (*name == '/')
+		snprintf(fn, sizeof(fn), "%s", name);
+	else
+		snprintf(fn, sizeof(fn), "%s/%s.pid", PIDPATH, name);
+
+	unlink(fn);
+}
+
 /* open pidfn, get the pid, then send it sig
 * returns negative codes for errors, or
 * zero for a successfully sent signal
diff -up nut-2.7.1/include/common.h.rmpidf nut-2.7.1/include/common.h
--- nut-2.7.1/include/common.h.rmpidf	2013-11-20 20:53:31.000000000 +0100
+++ nut-2.7.1/include/common.h	2014-02-27 11:41:09.146369353 +0100
@@ -70,6 +70,9 @@ void chroot_start(const char *path);
 /* write a pid file - <name> is a full pathname *or* just the program name */
 void writepid(const char *name);
 
+/* remove pid file */
+void cleanpid(const char *name);
+
 /* send a signal to another running process */
 int sendsignal(const char *progname, int sig);
 
diff -up nut-2.7.1/server/upsd.c.rmpidf nut-2.7.1/server/upsd.c
--- nut-2.7.1/server/upsd.c.rmpidf	2014-02-27 11:41:09.146369353 +0100
+++ nut-2.7.1/server/upsd.c	2014-02-27 11:42:03.715818754 +0100
@@ -1050,6 +1050,7 @@ int main(int argc, char **argv)
 	ssl_cleanup();
 
 	upslogx(LOG_INFO, "Signal %d: exiting", exit_flag);
+	if (*pidfn) cleanpid(pidfn);
 	return EXIT_SUCCESS;
 }
 
 
design & coding: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
current maintainer: Michael Shigorin