]>
git.ipfire.org Git - thirdparty/squid.git/blob - src/fatal.cc
6b556831f0fdda978cc0bef4cb5608176b5e7f08
2 * Copyright (C) 1996-2016 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.
13 #include "store/Disks.h"
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();
46 /* XXX: this should be turned into a callback-on-fatal, or
47 * a mandatory-shutdown-event or something like that.
53 * Call leave_suid() here to make sure that swap.state files
54 * are written as the effective user, rather than root. Squid
55 * may take on root privs during reconfigure. If squid.conf
56 * contains a "Bungled" line, fatal() will be called when the
57 * process still has root privs.
61 storeDirWriteCleanLogs(0);
63 fatal_common(message
);
70 fatalvf(const char *fmt
, va_list args
)
72 static char fatal_str
[BUFSIZ
];
73 vsnprintf(fatal_str
, sizeof(fatal_str
), fmt
, args
);
77 /* printf-style interface for fatal */
79 fatalf(const char *fmt
,...)
87 /* fatal with dumping core */
89 fatal_dump(const char *message
)
91 failure_notify
= NULL
;
92 releaseServerSockets();
95 fatal_common(message
);
98 * Call leave_suid() here to make sure that swap.state files
99 * are written as the effective user, rather than root. Squid
100 * may take on root privs during reconfigure. If squid.conf
101 * contains a "Bungled" line, fatal() will be called when the
102 * process still has root privs.
106 if (opt_catch_signals
)
107 storeDirWriteCleanLogs(0);