diff options
author | Laurent Bercot <ska-skaware@skarnet.org> | 2019-04-28 01:59:24 +0000 |
---|---|---|
committer | Laurent Bercot <ska-skaware@skarnet.org> | 2019-04-28 01:59:24 +0000 |
commit | 1f015e8ea5c10133fcd36ab377a87b6a50e44faa (patch) | |
tree | cce2593da021f291366dc43c28dc8157d97ebf9b /src | |
parent | c9f6d77e4f2913a801cdd7cd4c1d3b7cbb2e1e05 (diff) | |
download | s6-linux-init-1f015e8ea5c10133fcd36ab377a87b6a50e44faa.tar.xz |
Don't nochomp the initial environment
Diffstat (limited to 'src')
-rw-r--r-- | src/init/s6-linux-init-maker.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/init/s6-linux-init-maker.c b/src/init/s6-linux-init-maker.c index 365a556..32dd339 100644 --- a/src/init/s6-linux-init-maker.c +++ b/src/init/s6-linux-init-maker.c @@ -379,7 +379,7 @@ static void auto_exec (char const *base, char const *name, char const *target) auto_script(base, name, &linewithargs_script, target) ; } -static void make_env (char const *base, char const *envname, char const *modif, size_t modiflen) +static void make_env (char const *base, char const *envname, char *modif, size_t modiflen) { size_t envnamelen = strlen(envname) ; auto_dir(base, envname, 0, 0, 0755) ; @@ -393,7 +393,12 @@ static void make_env (char const *base, char const *envname, char const *modif, memcpy(fn + envnamelen + 1, modif, pos) ; fn[envnamelen + 1 + pos] = 0 ; - if (pos + 1 < len) auto_file(base, fn, modif + pos + 1, len - pos - 1) ; + if (pos + 1 < len) + { + modif[len] = '\n' ; + auto_file(base, fn, modif + pos + 1, len - pos) ; + modif[len] = 0 ; + } else if (pos + 1 == len) auto_file(base, fn, "\n", 1) ; else auto_file(base, fn, "", 0) ; modif += len+1 ; modiflen -= len+1 ; |