mirror of
https://github.com/troglobit/finit.git
synced 2026-10-02 05:52:48 +07:00
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 <troglobit@gmail.com>
This commit is contained in:
@@ -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)) {
|
||||
|
||||
Reference in New Issue
Block a user