sbase

suckless unix tools
git clone git://git.2f30.org/sbase
Log | Files | Refs | README | LICENSE

commit bb79b5c7eb9dc5f40bd150aff8a522609a0a2c4d
parent ddeb4c0e3569d32dde71ca3a0b76571afe84e17d
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date:   Fri, 20 Feb 2015 14:36:09 +0100

uudecode: fix no newline before EOF

Diffstat:
Muudecode.c | 6+++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/uudecode.c b/uudecode.c @@ -170,10 +170,10 @@ uudecode(FILE *fp, FILE *outfp) while ((len = getline(&bufb, &n, fp)) != -1) { p = bufb; /* trim newlines */ - if (len && bufb[len - 1] != '\n') - bufb[len - 1] = '\0'; - else + if (!len || bufb[len - 1] != '\n') eprintf("no newline found, aborting\n"); + bufb[len - 1] = '\0'; + /* check for last line */ if ((i = DEC(*p)) <= 0) break;