1
0
Fork 0
mirror of https://gitlab.alpinelinux.org/alpine/aports.git synced 2025-07-20 17:55:15 +03:00
aports/community/ax25-tools/ax25.patch
2023-10-25 13:45:40 +00:00

59 lines
1.3 KiB
Diff

--- a/ax25/ax25d.c
+++ b/ax25/ax25d.c
@@ -260,7 +260,8 @@ static void SignalTERM(int code)
syslog(LOG_INFO, "terminating on SIGTERM\n");
closelog();
}
-
+ // FIXME - hardcoded path
+ unlink("/var/run/ax25d.pid");
exit(0);
}
@@ -1083,6 +1084,17 @@ int main(int argc, char *argv[])
syslog(LOG_INFO, "starting");
}
+ /* gjcp - write PID file */
+ // FIXME - should be configurable
+ FILE *f = fopen("/var/run/ax25d.pid", "w");
+
+ if (f == NULL) {
+ syslog(LOG_WARNING, "Couldn't create PID file /var/run/ax25d.pid: %s", strerror(errno));
+ } else {
+ fprintf(f, "%ld\n", (long) getpid());
+ fclose(f);
+ }
+
act.sa_handler = SignalHUP;
sigemptyset(&act.sa_mask);
act.sa_flags = 0;
--- a/ax25/mheardd.c
+++ b/ax25/mheardd.c
@@ -98,7 +98,7 @@ static void terminate(int sig)
syslog(LOG_INFO, "terminating on SIGTERM\n");
closelog();
}
-
+ unlink("/var/run/mheardd.pid");
exit(0);
}
@@ -210,6 +210,17 @@ int main(int argc, char **argv)
syslog(LOG_INFO, "starting");
}
+ /* gjcp - write PID file */
+ // FIXME - should be configurable
+ FILE *f = fopen("/var/run/mheardd.pid", "w");
+
+ if (f == NULL) {
+ syslog(LOG_WARNING, "Couldn't create PID file /var/run/mheardd.pid: %s", strerror(errno));
+ } else {
+ fprintf(f, "%ld\n", (long) getpid());
+ fclose(f);
+ }
+
for (;;) {
asize = sizeof(sa);