From c6cead5dfe1080eabac232527e31f3f3a6de325e Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Tue, 16 Sep 1997 20:52:45 +0000 Subject: Autoconfigure correctly for SunOS boxes. svn path=/trunk/; revision=1355 --- NEWS | 1 + acconfig.h | 3 +++ configure.in | 11 +++++++++++ fetchmail.c | 2 +- fetchmail.man | 5 ++++- 5 files changed, 20 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index 516846de..a74b12ea 100644 --- a/NEWS +++ b/NEWS @@ -15,6 +15,7 @@ ------------------------------------------------------------------------------ fetchmail-4.2.2 () * Re-enable --limit under IMAP (bug introduced in 4.2.0). +* Autoconfigure root-mode PID-file directory to /etc if no /var/run. There are 285 people on the fetchmail-friends list. diff --git a/acconfig.h b/acconfig.h index c7ceaf43..e7f225a6 100644 --- a/acconfig.h +++ b/acconfig.h @@ -44,6 +44,9 @@ /* Define if you have on_exit */ #undef HAVE_ON_EXIT +/* Compute an appropriate directory for PID lock files */ +#undef PID_DIR + /* Define to help us deduce a 32-bit type (required for Kerberos) */ #undef SIZEOF_INT #undef SIZEOF_SHORT diff --git a/configure.in b/configure.in index 949e68c2..385292b3 100644 --- a/configure.in +++ b/configure.in @@ -128,6 +128,17 @@ AC_TRY_LINK([#include [AC_DEFINE(SYS_SIGLIST_DECLARED) AC_MSG_RESULT(yes)], AC_MSG_RESULT(no)) +# Find the right directory to put the root-mode PID file in +for dir in "/var/run" "/etc" +do + if test -d $dir + then + break; + fi +done +AC_MSG_RESULT(root-mode pid file will go in $dir) +AC_DEFINE_UNQUOTED(PID_DIR, "$dir") + AC_CHECK_SIZEOF(short) AC_CHECK_SIZEOF(int) AC_CHECK_SIZEOF(long) diff --git a/fetchmail.c b/fetchmail.c index 4730e1e7..fea23f37 100644 --- a/fetchmail.c +++ b/fetchmail.c @@ -131,7 +131,7 @@ int main (int argc, char **argv) /* set up to do lock protocol */ if (!getuid()) - strcpy(tmpbuf, "/var/run/fetchmail.pid"); + sprintf(tmpbuf, "%s/fetchmail.pid", PID_DIR); else { strcpy(tmpbuf, home); strcat(tmpbuf, "/.fetchmail"); diff --git a/fetchmail.man b/fetchmail.man index 28f4b63e..28275407 100644 --- a/fetchmail.man +++ b/fetchmail.man @@ -1313,7 +1313,10 @@ passwords as a last resort before prompting for one interactively. lock file to help prevent concurrent runs (non-root mode). .TP 5 /var/run/fetchmail.pid -lock file to help prevent concurrent runs (root mode). +lock file to help prevent concurrent runs (root mode, Linux systems). +.TP 5 +/etc/fetchmail.pid +lock file to help prevent concurrent runs (root mode, systems without /var/run). .SH ENVIRONMENT For correct initialization, -- cgit v1.2.3