about summary refs log tree commit diff
path: root/src/libenvexec
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2022-02-27 00:46:40 +0000
committerLaurent Bercot <ska@appnovation.com>2022-02-27 00:46:40 +0000
commitcb66b4d4fd29fdc460e871f16955ab7a895cd321 (patch)
tree60b307190a28a764dc753c247d225017f09de90e /src/libenvexec
parent2bc71103355d4bd63086a40b013667e1acbf810a (diff)
downloadskalibs-cb66b4d4fd29fdc460e871f16955ab7a895cd321.tar.gz
skalibs-cb66b4d4fd29fdc460e871f16955ab7a895cd321.tar.xz
skalibs-cb66b4d4fd29fdc460e871f16955ab7a895cd321.zip
Fix envdir_noclamp
Signed-off-by: Laurent Bercot <ska@appnovation.com>
Diffstat (limited to 'src/libenvexec')
-rw-r--r--src/libenvexec/envdir_noclamp.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/libenvexec/envdir_noclamp.c b/src/libenvexec/envdir_noclamp.c
index b87291a..0741c9d 100644
--- 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++ ;
   }