nano

nano with my custom patches
git clone git://bsandro.tech/nano
Log | Files | Refs | README | LICENSE

commit 76d90617cc1cd90014a9468dde599de31dfca0b4
parent f516cddce749c3bf938271ef3182b9169ac8cbcc
Author: Benno Schulenberg <bensberg@telfort.nl>
Date:   Fri,  6 Dec 2019 12:34:57 +0100

build: avoid three compiler warnings when using gcc-9.2 or newer

This addresses https://savannah.gnu.org/bugs/?57360.
Reported-by: Brand Huntsman <alpha@qzx.com>

Diffstat:
Msrc/files.c | 2+-
Msrc/nano.c | 2+-
Msrc/text.c | 2+-
3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/files.c b/src/files.c @@ -244,7 +244,7 @@ int write_lockfile(const char *lockfilename, const char *origfilename, bool modi lockdata[27] = mypid / (256 * 256 * 256); snprintf(&lockdata[2], 11, "nano %s", VERSION); strncpy(&lockdata[28], mypwuid->pw_name, 16); - strncpy(&lockdata[68], myhostname, 31); + strncpy(&lockdata[68], myhostname, 32); if (origfilename != NULL) strncpy(&lockdata[108], origfilename, 768); if (modified == TRUE) diff --git a/src/nano.c b/src/nano.c @@ -255,7 +255,7 @@ void unpartition_buffer(void) strlen(antedata) + strlen(openfile->filetop->data) + 1); memmove(openfile->filetop->data + strlen(antedata), openfile->filetop->data, strlen(openfile->filetop->data) + 1); - strncpy(openfile->filetop->data, antedata, strlen(antedata)); + memcpy(openfile->filetop->data, antedata, strlen(antedata)); free(antedata); antedata = NULL; diff --git a/src/text.c b/src/text.c @@ -102,7 +102,7 @@ void indent_a_line(linestruct *line, char *indentation) /* Add the fabricated indentation to the beginning of the line. */ line->data = charealloc(line->data, length + indent_len + 1); memmove(line->data + indent_len, line->data, length + 1); - strncpy(line->data, indentation, indent_len); + memcpy(line->data, indentation, indent_len); openfile->totsize += indent_len;