### Eclipse Workspace Patch 1.0 #P squid2-HEAD Index: src/main.c =================================================================== RCS file: /squid/squid/src/main.c,v retrieving revision 1.407 diff -u -r1.407 main.c --- src/main.c 2 Aug 2008 11:40:15 -0000 1.407 +++ src/main.c 12 Aug 2008 05:17:27 -0000 @@ -106,6 +106,10 @@ #if defined(USE_WIN32_SERVICE) && defined(_SQUID_WIN32_) " -n name Specify Windows Service name to use for service operations\n" " default is: " _WIN_SQUID_DEFAULT_SERVICE_NAME ".\n" +#endif + " -p Ignore redundant starts (when squid is already running) and\n" + " stops (when squid isn't running)." +#if defined(USE_WIN32_SERVICE) && defined(_SQUID_WIN32_) " -r Removes a Windows Service (see -n option).\n" #endif " -s | -l facility\n" @@ -137,9 +141,9 @@ int c; #if defined(USE_WIN32_SERVICE) && defined(_SQUID_WIN32_) - while ((c = getopt(argc, argv, "CDFIO:RSYXd:f:hik:m::n:rsl:u:vz?")) != -1) { + while ((c = getopt(argc, argv, "CDFIO:RSYXd:f:hik:m::n:prsl:u:vz?")) != -1) { #else - while ((c = getopt(argc, argv, "CDFINRSYXd:f:hk:m::sl:u:vz?")) != -1) { + while ((c = getopt(argc, argv, "CDFINRSYXd:f:hk:m::psl:u:vz?")) != -1) { #endif switch (c) { case 'C': @@ -258,6 +262,9 @@ fatal("Logging to syslog not available on this platform"); /* NOTREACHED */ #endif + case 'p': + opt_idempotent = 1; + break; case 'u': icpPortNumOverride = atoi(optarg); if (icpPortNumOverride < 0) @@ -911,6 +918,8 @@ #if defined(USE_WIN32_SERVICE) && defined(_SQUID_CYGWIN_) } #endif + } else if (opt_idempotent) { + fprintf(stderr, "%s: WARNING: No running copy\n", appname); } else { fprintf(stderr, "%s: ERROR: No running copy\n", appname); exit(1); @@ -973,7 +982,10 @@ if (kill(pid, 0) < 0) return 0; debug(0, 0) ("Squid is already running! Process ID %ld\n", (long int) pid); - return 1; + if (opt_idempotent) + return 0; + else + return 1; } static void Index: src/globals.h =================================================================== RCS file: /squid/squid/src/globals.h,v retrieving revision 1.128 diff -u -r1.128 globals.h --- src/globals.h 27 May 2008 00:00:33 -0000 1.128 +++ src/globals.h 12 Aug 2008 05:17:26 -0000 @@ -85,6 +85,7 @@ extern int opt_catch_signals; /* 1 */ extern int opt_debug_stderr; /* -1 */ extern int opt_dns_tests; /* 1 */ +extern int opt_idempotent; /* 0 */ extern int opt_foreground_rebuild; /* 0 */ extern forwarded_for_mode opt_forwarded_for; /* FORWARDED_FOR_ON */ extern int opt_reload_hit_only; /* 0 */