Skip to content

Commit 939ae02

Browse files
committed
Increase MAX command, and arg., length: 64 -> 256
With non-standard paths, e.g., when running `make distcheck`, the absolute path to some commands become ridiculously long. However, this has been a recurring issue for some users in the past, so it is time to increase the capabilibieies of Finit to cover this. Yes, a better way is probably to allocate all these strings when they are used, but that would require a redesign of the initctl API and likely cause a lot of regressions before everything has stabilized. Signed-off-by: Joachim Wiberg <[email protected]>
1 parent 480d291 commit 939ae02

File tree

3 files changed

+10
-9
lines changed

3 files changed

+10
-9
lines changed

plugins/modules-load.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ static int modules_load(const char *file, int index)
101101
}
102102

103103
while ((line = fparseln(fp, NULL, NULL, NULL, 0))) {
104-
char cmd[CMD_SIZE * 2], *mod, *args, *set;
104+
char cmd[CMD_SIZE], *mod, *args, *set;
105105

106106
/*
107107
* fparseln() skips regular UNIX comments only.

src/finit.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
#define _PATH_SULOGIN FINIT_EXECPATH_ "/sulogin"
6161
#define _PATH_GETTY FINIT_EXECPATH_ "/getty"
6262

63-
#define CMD_SIZE 256
63+
#define CMD_SIZE 1024
6464
#define LINE_SIZE 1024
6565
#define BUF_SIZE 4096
6666

src/svc.h

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ typedef enum {
8585

8686
#define MAX_ID_LEN 16
8787
#define MAX_ARG_LEN 64
88+
#define MAX_CMD_LEN 256
8889
#define MAX_IDENT_LEN (MAX_ARG_LEN + MAX_ID_LEN + 1)
8990
#define MAX_STR_LEN 64
9091
#define MAX_COND_LEN (MAX_ARG_LEN * 3)
@@ -118,7 +119,7 @@ typedef struct svc {
118119
int sighalt; /* Signal to stop process, default: SIGTERM */
119120
int killdelay; /* Delay in msec before sending SIGKILL */
120121
pid_t oldpid, pid;
121-
char pidfile[256];
122+
char pidfile[MAX_CMD_LEN];
122123
long start_time; /* Start time, as seconds since boot, from sysinfo() */
123124
int started; /* Set for run/task/sysv to track if started */
124125
int status; /* From waitpid() when process is collected */
@@ -181,15 +182,15 @@ typedef struct svc {
181182
char group[MAX_USER_LEN];
182183

183184
/* Command, arguments and service description */
184-
char cmd[MAX_ARG_LEN];
185-
char args[MAX_NUM_SVC_ARGS][MAX_ARG_LEN];
185+
char cmd[MAX_CMD_LEN];
186+
char args[MAX_NUM_SVC_ARGS][MAX_CMD_LEN];
186187
int args_dirty;
187188
char conflict[MAX_ARG_LEN];
188189
char desc[MAX_STR_LEN];
189-
char env[MAX_ARG_LEN];
190-
char pre_script[MAX_ARG_LEN];
191-
char post_script[MAX_ARG_LEN];
192-
char ready_script[MAX_ARG_LEN];
190+
char env[MAX_CMD_LEN];
191+
char pre_script[MAX_CMD_LEN];
192+
char post_script[MAX_CMD_LEN];
193+
char ready_script[MAX_CMD_LEN];
193194

194195
/*
195196
* Used to forcefully kill services that won't shutdown on

0 commit comments

Comments
 (0)