mirror of
https://github.com/tmate-io/tmate.git
synced 2025-02-18 19:30:59 +01:00
Don't die on empty strings.
This commit is contained in:
parent
ea80307acb
commit
0bfd7a5023
6
CHANGES
6
CHANGES
@ -1,3 +1,7 @@
|
|||||||
|
14 June 2008
|
||||||
|
|
||||||
|
* Don't die on empty strings in config file, reported by Will Maier.
|
||||||
|
|
||||||
08 June 2008
|
08 June 2008
|
||||||
|
|
||||||
* Set socket mode +x if any sessions are attached and -x if not.
|
* Set socket mode +x if any sessions are attached and -x if not.
|
||||||
@ -460,4 +464,4 @@
|
|||||||
(including mutt, emacs). No status bar yet and no key remapping or other
|
(including mutt, emacs). No status bar yet and no key remapping or other
|
||||||
customisation.
|
customisation.
|
||||||
|
|
||||||
$Id: CHANGES,v 1.117 2008-06-08 19:49:04 nicm Exp $
|
$Id: CHANGES,v 1.118 2008-06-14 08:11:16 nicm Exp $
|
||||||
|
26
cfg.c
26
cfg.c
@ -1,4 +1,4 @@
|
|||||||
/* $Id: cfg.c,v 1.6 2008-06-02 22:16:27 nicm Exp $ */
|
/* $Id: cfg.c,v 1.7 2008-06-14 08:11:17 nicm Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net>
|
* Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||||
@ -99,36 +99,36 @@ load_cfg(const char *path, char **causep)
|
|||||||
case '\t':
|
case '\t':
|
||||||
if (len != 0) {
|
if (len != 0) {
|
||||||
buf[len] = '\0';
|
buf[len] = '\0';
|
||||||
|
|
||||||
argv = xrealloc(
|
argv = xrealloc(
|
||||||
argv, argc + 1, sizeof (char *));
|
argv, argc + 1, sizeof (char *));
|
||||||
argv[argc++] = buf;
|
argv[argc++] = buf;
|
||||||
|
|
||||||
buf = NULL;
|
buf = NULL;
|
||||||
len = 0;
|
len = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ch != '\n' && ch != EOF)
|
if (ch != '\n' && ch != EOF)
|
||||||
break;
|
break;
|
||||||
line++;
|
line++;
|
||||||
if (argc == 0)
|
if (argc == 0)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if ((cmd = cmd_parse(argc, argv, &cause)) == NULL)
|
if ((cmd = cmd_parse(argc, argv, &cause)) == NULL)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
ctx.msgdata = NULL;
|
ctx.msgdata = NULL;
|
||||||
ctx.cursession = NULL;
|
ctx.cursession = NULL;
|
||||||
ctx.curclient = NULL;
|
ctx.curclient = NULL;
|
||||||
|
|
||||||
ctx.error = cfg_error;
|
ctx.error = cfg_error;
|
||||||
ctx.print = cfg_print;
|
ctx.print = cfg_print;
|
||||||
|
|
||||||
ctx.cmdclient = NULL;
|
ctx.cmdclient = NULL;
|
||||||
ctx.flags = 0;
|
ctx.flags = 0;
|
||||||
|
|
||||||
cfg_cause = NULL;
|
cfg_cause = NULL;
|
||||||
cmd_exec(cmd, &ctx);
|
cmd_exec(cmd, &ctx);
|
||||||
cmd_free(cmd);
|
cmd_free(cmd);
|
||||||
if (cfg_cause != NULL) {
|
if (cfg_cause != NULL) {
|
||||||
cause = cfg_cause;
|
cause = cfg_cause;
|
||||||
@ -142,7 +142,7 @@ load_cfg(const char *path, char **causep)
|
|||||||
default:
|
default:
|
||||||
if (len >= SIZE_MAX - 2)
|
if (len >= SIZE_MAX - 2)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
buf = xrealloc(buf, 1, len + 1);
|
buf = xrealloc(buf, 1, len + 1);
|
||||||
buf[len++] = ch;
|
buf[len++] = ch;
|
||||||
break;
|
break;
|
||||||
@ -163,7 +163,7 @@ error:
|
|||||||
|
|
||||||
if (cause == NULL)
|
if (cause == NULL)
|
||||||
xasprintf(causep, "%s: error at line %u", path, line);
|
xasprintf(causep, "%s: error at line %u", path, line);
|
||||||
else
|
else
|
||||||
xasprintf(causep, "%s: %s at line %u", path, cause, line);
|
xasprintf(causep, "%s: %s at line %u", path, cause, line);
|
||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
@ -175,7 +175,7 @@ cfg_string(FILE *f, char endch, int esc)
|
|||||||
char *buf;
|
char *buf;
|
||||||
size_t len;
|
size_t len;
|
||||||
|
|
||||||
buf = NULL;
|
buf = xmalloc(1);
|
||||||
len = 0;
|
len = 0;
|
||||||
|
|
||||||
while ((ch = getc(f)) != endch) {
|
while ((ch = getc(f)) != endch) {
|
||||||
@ -211,6 +211,6 @@ cfg_string(FILE *f, char endch, int esc)
|
|||||||
buf[len++] = ch;
|
buf[len++] = ch;
|
||||||
}
|
}
|
||||||
|
|
||||||
buf[len] = '\0';
|
buf[len] = '\0';
|
||||||
return (buf);
|
return (buf);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user