diff options
author | David Schury | 2015-07-22 13:55:54 +0200 |
---|---|---|
committer | David Schury | 2015-07-22 13:55:54 +0200 |
commit | 31b3b24ff654e46f6279dfeddec8df2f32658b71 (patch) | |
tree | b4e82c356d887146ab6351e283c8070e5632958c /pidfile.patch | |
parent | 90c464618fd734c3abf6640e04ab9bd9feb17b57 (diff) | |
parent | 1c13cb2268c99230ccdd07a4bf928634f69fb909 (diff) | |
download | aur-31b3b24ff654e46f6279dfeddec8df2f32658b71.tar.gz |
Fixed issues with v1.99.14 and updated.
Diffstat (limited to 'pidfile.patch')
-rw-r--r-- | pidfile.patch | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/pidfile.patch b/pidfile.patch new file mode 100644 index 000000000000..596fa9b67870 --- /dev/null +++ b/pidfile.patch @@ -0,0 +1,63 @@ +diff --git a/src/os.c b/src/os.c +index 66c3ada..246c10f 100644 +--- a/src/os.c ++++ b/src/os.c +@@ -33,7 +33,6 @@ + #include "debug.h" + #include "ddns.h" + #include "cache.h" +-#include "libite/lite.h" + + #define MAXSTRING 1024 + +@@ -421,6 +420,39 @@ static int mkparentdir(char *file) + return rc; + } + ++static void pidexit(void) ++{ ++ if (pidfile_path) { ++ unlink(pidfile_path); ++ free(pidfile_path); ++ pidfile_path = NULL; ++ } ++} ++ ++/* Continue using old pidfile fn for Inadyn 1.x series, ++ * incompatible semantics with OpenBSD version. */ ++static int old_pidfile(char *file) ++{ ++ FILE *fp; ++ ++ /* Ignore any errors, we may not be allowed to create the dir, ++ * but still be able to create/overwrite the pidfile. */ ++ mkparentdir(file); ++ ++ fp = fopen(file, "w"); ++ if (!fp) { ++ logit(LOG_ERR, "Failed creating pidfile %s: %s", file, strerror(errno)); ++ return RC_FILE_IO_ACCESS_ERROR; ++ } ++ ++ fprintf(fp, "%u\n", getpid()); ++ fclose(fp); ++ ++ atexit(pidexit); ++ ++ return 0; ++} ++ + /* Create pid and cache file repository, make sure we can write to it. If + * we are restarted we cannot otherwise make sure we've not already updated + * the IP -- and the user will be locked-out of their DDNS server provider +@@ -440,8 +472,8 @@ int os_check_perms(void *UNUSED(arg)) + return RC_FILE_IO_ACCESS_ERROR; + } + +- /* Not creating a pidfile is OK, the cache file is the critical point. */ +- pidfile(pidfile_path); ++ if (old_pidfile(pidfile_path)) ++ logit(LOG_WARNING, "Failed creating pidfile %s: %m", pidfile_path); + + return 0; + } |