From 77b0df3d07768ee3129a0d52f410706cee0bd018 Mon Sep 17 00:00:00 2001 From: Joachim Nilsson Date: Mon, 8 Oct 2012 11:42:16 +0200 Subject: [PATCH] Bugfix: Do not free() static string in new runparts directive This is a bugfix to 785c21d, which introduced the new runparts directive in finit.conf - Do not attempt to free() a static string, use same approach as username and hostname. - Do not overwrite hostname, set the correct variable if runparts directive is found in finit.conf Signed-off-by: Joachim Nilsson --- conf.c | 4 ++-- finit.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/conf.c b/conf.c index 48a95e2b..a18ebf08 100644 --- a/conf.c +++ b/conf.c @@ -64,9 +64,9 @@ void parse_finit_conf(char *file) char line[LINE_SIZE]; char cmd[CMD_SIZE]; - /* Default username and hostname */ username = strdup(DEFUSER); hostname = strdup(DEFHOST); + rcsd = strdup(FINIT_RCSD); if ((fp = fopen(file, "r")) != NULL) { char *x; @@ -124,7 +124,7 @@ void parse_finit_conf(char *file) } if (MATCH_CMD(line, "runparts ", x)) { if (rcsd) free(rcsd); - hostname = build_cmd(NULL, x, CMD_SIZE); + rcsd = build_cmd(NULL, x, CMD_SIZE); continue; } if (MATCH_CMD(line, "startx ", x)) { diff --git a/finit.c b/finit.c index 97f019d0..1db58aa2 100644 --- a/finit.c +++ b/finit.c @@ -41,7 +41,7 @@ char *sdown = NULL; char *network = NULL; char *username = NULL; char *hostname = NULL; -char *rcsd = FINIT_RCSD; +char *rcsd = NULL; static void parse_kernel_cmdline(void)