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>
master
Benno Schulenberg 2019-12-06 12:34:57 +01:00
parent f516cddce7
commit 76d90617cc
3 changed files with 3 additions and 3 deletions

View File

@ -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)

View File

@ -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;

View File

@ -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;