fix(server.c): add newline only if there isn't one already

This commit is contained in:
Tom MTT. 2022-11-29 16:06:27 +01:00
parent 8764f00655
commit fdd0d73e77
3 changed files with 8 additions and 5 deletions

View file

@ -1,5 +1,5 @@
# feuille version
VERSION = 1.19.3
VERSION = 1.19.4
# paths (customize them to fit your system)
PREFIX = /usr/local

View file

@ -14,7 +14,7 @@
. ftr VB CB
. ftr VBI CBI
.\}
.TH "feuille" "1" "November 2022" "feuille 1.19.3" ""
.TH "feuille" "1" "November 2022" "feuille 1.19.4" ""
.hy
.SH NAME
.PP

View file

@ -227,11 +227,14 @@ unsigned long read_paste(int connection, char **output)
return 0;
}
/* end the buffer with a newline */
/* end the buffer with a newline if there's none */
if (buffer[total_size - 1] != '\n') {
buffer[total_size] = '\n';
total_size++; /* add newline to total size */
}
*output = buffer;
return total_size + 1; /* newline */
return total_size;
}
/**