Merge pull request #59 from mehmetumit/master

\0 delimeter issue fixed
This was clearly just an oversight. Thanks for the fix!
This commit is contained in:
torrinfail 2022-01-06 19:45:08 -07:00 committed by GitHub
commit ba866be168
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -70,9 +70,9 @@ void getcmd(const Block *block, char *output)
pclose(cmdf); pclose(cmdf);
return; return;
} }
//only chop off newline if one is present at the end
i = output[i-1] == '\n' ? i-1 : i;
if (delim[0] != '\0') { if (delim[0] != '\0') {
//only chop off newline if one is present at the end
i = output[i-1] == '\n' ? i-1 : i;
strncpy(output+i, delim, delimLen); strncpy(output+i, delim, delimLen);
} }
else else