skalibs

Mirror/fork of https://skarnet.org/software/skalibs/
git clone https://ccx.te2000.cz/git/skalibs
Log | Files | Refs | README | LICENSE

commit cb66b4d4fd29fdc460e871f16955ab7a895cd321
parent 2bc71103355d4bd63086a40b013667e1acbf810a
Author: Laurent Bercot <ska-skaware@skarnet.org>
Date:   Sun, 27 Feb 2022 00:46:40 +0000

 Fix envdir_noclamp

Signed-off-by: Laurent Bercot <ska@appnovation.com>

Diffstat:
Msrc/libenvexec/envdir_noclamp.c | 6+++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/libenvexec/envdir_noclamp.c b/src/libenvexec/envdir_noclamp.c @@ -64,12 +64,12 @@ int envdir_internal_noclamp (char const *path, stralloc *modifs, unsigned int op { if (errno != EPIPE) goto errfd ; if (!(options & SKALIBS_ENVDIR_NOCHOMP)) modifs->len = pos ; - if (!stralloc_catb(modifs, "\n", 1)) goto errfd ; + modifs->len++ ; } if (!r) modifs->len = pos - 1 ; else { - size_t i = pos ; + modifs->len-- ; if (!(options & SKALIBS_ENVDIR_NOCHOMP)) { while (modifs->len-- > pos) @@ -78,11 +78,11 @@ int envdir_internal_noclamp (char const *path, stralloc *modifs, unsigned int op if ((c != ' ') && (c != '\t') && (c != '\r')) break ; } modifs->len++ ; - for (; i < modifs->len ; i++) if (!modifs->s[i]) modifs->s[i] = nullis ; } } } fd_close(fd) ; + for (; pos < modifs->len ; pos++) if (!modifs->s[pos]) modifs->s[pos] = nullis ; if (!stralloc_0(modifs)) goto err ; n++ ; }