tinc-1.1-fix-paths.patch 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. diff -Naur tinc-1.1pre14.orig/src/names.c tinc-1.1pre14/src/names.c
  2. --- tinc-1.1pre14.orig/src/names.c 2016-04-17 12:08:41.000000000 -0400
  3. +++ tinc-1.1pre14/src/names.c 2016-10-15 07:37:51.147064396 -0400
  4. @@ -86,36 +86,11 @@
  5. if(!pidfilename)
  6. xasprintf(&pidfilename, "%s" SLASH "pid", confbase);
  7. #else
  8. - bool fallback = false;
  9. - if(daemon) {
  10. - if(access(LOCALSTATEDIR, R_OK | W_OK | X_OK))
  11. - fallback = true;
  12. - } else {
  13. - char fname[PATH_MAX];
  14. - snprintf(fname, sizeof fname, LOCALSTATEDIR SLASH "run" SLASH "%s.pid", identname);
  15. - if(access(fname, R_OK)) {
  16. - snprintf(fname, sizeof fname, "%s" SLASH "pid", confbase);
  17. - if(!access(fname, R_OK))
  18. - fallback = true;
  19. - }
  20. - }
  21. + if(!logfilename)
  22. + xasprintf(&logfilename, "/var/log" SLASH "%s.log", identname);
  23. - if(!fallback) {
  24. - if(!logfilename)
  25. - xasprintf(&logfilename, LOCALSTATEDIR SLASH "log" SLASH "%s.log", identname);
  26. -
  27. - if(!pidfilename)
  28. - xasprintf(&pidfilename, LOCALSTATEDIR SLASH "run" SLASH "%s.pid", identname);
  29. - } else {
  30. - if(!logfilename)
  31. - xasprintf(&logfilename, "%s" SLASH "log", confbase);
  32. -
  33. - if(!pidfilename) {
  34. - if(daemon)
  35. - logger(DEBUG_ALWAYS, LOG_WARNING, "Could not access " LOCALSTATEDIR SLASH " (%s), storing pid and socket files in %s" SLASH, strerror(errno), confbase);
  36. - xasprintf(&pidfilename, "%s" SLASH "pid", confbase);
  37. - }
  38. - }
  39. + if(!pidfilename)
  40. + xasprintf(&pidfilename, "/run" SLASH "%s.pid", identname);
  41. #endif
  42. if(!unixsocketname) {