Commit 23cf15ca authored by Lasse Karstensen's avatar Lasse Karstensen

Polish the heritage structure a little bit, and don't pass the

panic_string to syslog until we have washed it.

4.1.1 merge note: Initial panic.show output string changed 4.1.0 format,
to keep scripts looking for panics working across upgrade.
parent c2c7df3b
......@@ -623,7 +623,7 @@ VRT_r_server_identity(VRT_CTX)
{
CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);
if (heritage.identity[0] != '\0')
if (heritage.identity != NULL)
return (heritage.identity);
else
return (heritage.name);
......
......@@ -56,7 +56,6 @@ struct heritage {
/* Sockets from which to accept connections */
struct listen_sock_head socks;
unsigned nsocks;
/* Hash method */
const struct hash_slinger *hash;
......@@ -66,7 +65,7 @@ struct heritage {
struct params *param;
char *name;
char identity[1024];
const char *identity;
char *panic_str;
ssize_t panic_str_len;
......
......@@ -125,18 +125,17 @@ mgt_panic_record(pid_t r)
{
char time_str[30];
AN(heritage.panic_str[0]);
REPORT(LOG_ERR, "Child (%jd) Panic message:\n%s",
(intmax_t)r, heritage.panic_str);
if (child_panic != NULL)
VSB_delete(child_panic);
child_panic = VSB_new_auto();
AN(child_panic);
VTIM_format(VTIM_real(), time_str);
VSB_printf(child_panic, "Last panic at: %s\n", time_str);
VSB_cat(child_panic, heritage.panic_str);
VSB_quote(child_panic, heritage.panic_str,
strnlen(heritage.panic_str, heritage.panic_str_len), 0);
AZ(VSB_finish(child_panic));
REPORT(LOG_ERR, "Child (%jd) %s",
(intmax_t)r, VSB_data(child_panic));
}
static void
......
......@@ -424,9 +424,10 @@ identify(const char *i_arg)
strcpy(id, "varnishd");
if (i_arg != NULL) {
if (strlen(i_arg) + 1 > sizeof heritage.identity)
ARGV_ERR("Identity (-i) name too long.\n");
strcpy(heritage.identity, i_arg);
if (strlen(i_arg) + 1 > 1024)
ARGV_ERR("Identity (-i) name too long (max 1023).\n");
heritage.identity = strdup(i_arg);
AN(heritage.identity);
i = strlen(id);
id[i++] = '/';
for (; i < (sizeof(id) - 1L); i++) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment