]>
git.ipfire.org Git - thirdparty/squid.git/blob - src/fatal.cc
2 * Copyright (C) 1996-2014 The Squid Software Foundation and contributors
4 * Squid software is distributed under GPLv2+ license and includes
5 * contributions from numerous individuals and organizations.
6 * Please see the COPYING and CONTRIBUTORS files for details.
17 fatal_common(const char *message
)
20 syslog(LOG_ALERT
, "%s", message
);
23 fprintf(debug_log
, "FATAL: %s\n", message
);
25 if (Debug::log_stderr
> 0 && debug_log
!= stderr
)
26 fprintf(stderr
, "FATAL: %s\n", message
);
28 fprintf(debug_log
, "Squid Cache (Version %s): Terminated abnormally.\n",
39 fatal(const char *message
)
41 /* suppress secondary errors from the dying */
44 releaseServerSockets();
45 /* check for store_dirs_rebuilding because fatal() is often
46 * used in early initialization phases, long before we ever
47 * get to the store log. */
49 /* XXX: this should be turned into a callback-on-fatal, or
50 * a mandatory-shutdown-event or something like that.
56 * Call leave_suid() here to make sure that swap.state files
57 * are written as the effective user, rather than root. Squid
58 * may take on root privs during reconfigure. If squid.conf
59 * contains a "Bungled" line, fatal() will be called when the
60 * process still has root privs.
64 if (0 == StoreController::store_dirs_rebuilding
)
65 storeDirWriteCleanLogs(0);
67 fatal_common(message
);
74 fatalvf(const char *fmt
, va_list args
)
76 static char fatal_str
[BUFSIZ
];
77 vsnprintf(fatal_str
, sizeof(fatal_str
), fmt
, args
);
81 /* printf-style interface for fatal */
83 fatalf(const char *fmt
,...)
91 /* fatal with dumping core */
93 fatal_dump(const char *message
)
95 failure_notify
= NULL
;
96 releaseServerSockets();
99 fatal_common(message
);
102 * Call leave_suid() here to make sure that swap.state files
103 * are written as the effective user, rather than root. Squid
104 * may take on root privs during reconfigure. If squid.conf
105 * contains a "Bungled" line, fatal() will be called when the
106 * process still has root privs.
110 if (opt_catch_signals
)
111 storeDirWriteCleanLogs(0);