aboutsummaryrefslogtreecommitdiff
path: root/src/pidfile.c
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org>2020-04-18 22:36:27 +0300
committerSergey Poznyakoff <gray@gnu.org>2020-04-18 22:36:27 +0300
commit84838fa69592cf37f97aaa918ad4e69b8bd4d62a (patch)
tree1f0395d1ff3f5ad391155bcd819ee77b972eb02f /src/pidfile.c
parent5e93c56acf080ef006176076be4efab4aa0591c0 (diff)
downloadwydawca-84838fa69592cf37f97aaa918ad4e69b8bd4d62a.tar.gz
wydawca-84838fa69592cf37f97aaa918ad4e69b8bd4d62a.tar.bz2
Modify pidfile functions
Diffstat (limited to 'src/pidfile.c')
-rw-r--r--src/pidfile.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/src/pidfile.c b/src/pidfile.c
index edd8e09..efd2f80 100644
--- a/src/pidfile.c
+++ b/src/pidfile.c
@@ -20,13 +20,13 @@ char *pidfile = LOCALSTATEDIR "/run/wydawca.pid";
int force_startup;
void
-remove_pidfile(void)
+pidfile_remove(void)
{
unlink(pidfile);
}
void
-check_pidfile()
+pidfile_check(void)
{
FILE *fp = fopen(pidfile, "r+");
@@ -60,7 +60,7 @@ check_pidfile()
strerror(errno));
exit(EX_UNAVAILABLE);
} else {
- fp = fopen(pidfile, "w");
+ fp = fopen(pidfile, "w");
if (!fp) {
wy_log(LOG_ERR,
_("cannot open pidfile %s for writing: %s"),
@@ -71,3 +71,17 @@ check_pidfile()
fprintf(fp, "%lu\n", (unsigned long) getpid());
fclose(fp);
}
+
+void
+pidfile_update(void)
+{
+ FILE *fp = fopen(pidfile, "w");
+ if (!fp) {
+ wy_log(LOG_ERR,
+ _("cannot open pidfile %s for writing: %s"),
+ pidfile, strerror(errno));
+ exit(EX_UNAVAILABLE);
+ }
+ fprintf(fp, "%lu\n", (unsigned long) getpid());
+ fclose(fp);
+}

Return to:

Send suggestions and report system problems to the System administrator.