aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/libcoopgamma.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/libcoopgamma.c b/src/libcoopgamma.c
index b024f52..a20a4e1 100644
--- a/src/libcoopgamma.c
+++ b/src/libcoopgamma.c
@@ -906,6 +906,23 @@ int libcoopgamma_get_method_and_site(const char* restrict method, const char* re
*/
char* libcoopgamma_get_pid_file(const char* restrict method, const char* restrict site)
{
+ char* path;
+ size_t n;
+
+ path = libcoopgamma_get_socket_file(method, site);
+ if (path == NULL)
+ return NULL;
+
+ n = strlen(path);
+ if (n < 7 || strcmp(path + n - 7, ".socket"))
+ {
+ free(path);
+ errno = EBADMSG;
+ return NULL;
+ }
+
+ strcpy(path + n - 7, ".pid");
+ return path;
}