aboutsummaryrefslogtreecommitdiffstats
path: root/src/mds.c
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2014-04-21 02:29:38 +0200
committerMattias Andrée <maandree@operamail.com>2014-04-21 02:29:38 +0200
commit419beedef7c03ec86c16d523ba90bc6329d4d6c8 (patch)
treed10b806f002a0a54558e9fc61a85aec90e138ca2 /src/mds.c
parentm (diff)
downloadmds-419beedef7c03ec86c16d523ba90bc6329d4d6c8.tar.gz
mds-419beedef7c03ec86c16d523ba90bc6329d4d6c8.tar.bz2
mds-419beedef7c03ec86c16d523ba90bc6329d4d6c8.tar.xz
mds-server: parse command line arguments
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to 'src/mds.c')
-rw-r--r--src/mds.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/mds.c b/src/mds.c
index d1ab07f..a263173 100644
--- a/src/mds.c
+++ b/src/mds.c
@@ -246,7 +246,7 @@ int spawn_and_respawn_server(int fd)
struct timespec time_end;
char* child_args[ARGC_LIMIT + LIBEXEC_ARGC_EXTRA_LIMIT + 1];
char pathname[PATH_MAX];
- char fdstr[64];
+ char fdstr[12 /* strlen("--socket-fd=") */ + 64];
int i;
pid_t pid;
int status;
@@ -260,13 +260,12 @@ int spawn_and_respawn_server(int fd)
child_args[i] = argv[i];
child_args[argc + 0] = strdup("--initial-spawn");
- child_args[argc + 1] = strdup("--socket-fd");
- snprintf(fdstr, sizeof(fdstr) / sizeof(char), "%i", fd);
- child_args[argc + 2] = fdstr;
- child_args[argc + 3] = NULL;
+ snprintf(fdstr, sizeof(fdstr) / sizeof(char), "--socket-fd=%i", fd);
+ child_args[argc + 1] = fdstr;
+ child_args[argc + 2] = NULL;
-#if (LIBEXEC_ARGC_EXTRA_LIMIT < 3)
-# error LIBEXEC_ARGC_EXTRA_LIMIT is too small, need at least 3.
+#if (LIBEXEC_ARGC_EXTRA_LIMIT < 2)
+# error LIBEXEC_ARGC_EXTRA_LIMIT is too small, need at least 2.
#endif
for (;;)