mirror of
https://github.com/troglobit/finit.git
synced 2026-12-04 21:58:19 +00: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:
1 parent
7e3465a022
commit
77b0df3d07
2 files changed
+3
-3
No files matched your search
@@ -64,9 +64,9 @@ void parse_finit_conf(char *file)
|
|||||||
char line[LINE_SIZE];
|
char line[LINE_SIZE];
|
||||||
char cmd[CMD_SIZE];
|
char cmd[CMD_SIZE];
|
||||||
|
|
||||||
/* Default username and hostname */
|
|
||||||
username = strdup(DEFUSER);
|
username = strdup(DEFUSER);
|
||||||
hostname = strdup(DEFHOST);
|
hostname = strdup(DEFHOST);
|
||||||
|
rcsd = strdup(FINIT_RCSD);
|
||||||
|
|
||||||
if ((fp = fopen(file, "r")) != NULL) {
|
if ((fp = fopen(file, "r")) != NULL) {
|
||||||
char *x;
|
char *x;
|
||||||
@@ -124,7 +124,7 @@ void parse_finit_conf(char *file)
|
|||||||
}
|
}
|
||||||
if (MATCH_CMD(line, "runparts ", x)) {
|
if (MATCH_CMD(line, "runparts ", x)) {
|
||||||
if (rcsd) free(rcsd);
|
if (rcsd) free(rcsd);
|
||||||
hostname = build_cmd(NULL, x, CMD_SIZE);
|
rcsd = build_cmd(NULL, x, CMD_SIZE);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (MATCH_CMD(line, "startx ", x)) {
|
if (MATCH_CMD(line, "startx ", x)) {
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ char *sdown = NULL;
|
|||||||
char *network = NULL;
|
char *network = NULL;
|
||||||
char *username = NULL;
|
char *username = NULL;
|
||||||
char *hostname = NULL;
|
char *hostname = NULL;
|
||||||
char *rcsd = FINIT_RCSD;
|
char *rcsd = NULL;
|
||||||
|
|
||||||
|
|
||||||
static void parse_kernel_cmdline(void)
|
static void parse_kernel_cmdline(void)
|
||||||
|
|||||||
Reference in new issue
Block a user