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

main
Tom MTT. 1 year ago
parent 8764f00655
commit fdd0d73e77

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

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

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

Loading…
Cancel
Save