mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 18:40:43 +03:00
Fedora 28: Fix misc bounds check compiler warnings
Fix a bunch of (mostly) sprintf/snprintf truncation compiler warnings that show up on Fedora 28 (GCC 8.0.1). Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Tony Hutter <hutter2@llnl.gov> Closes #7361 Closes #7368
This commit is contained in:
committed by
Brian Behlendorf
parent
1724eb62de
commit
21a4f5cc86
@@ -137,8 +137,12 @@ mktree(char *pdir, int level)
|
||||
static char *
|
||||
getfdname(char *pdir, char type, int level, int dir, int file)
|
||||
{
|
||||
(void) snprintf(fdname, sizeof (fdname),
|
||||
"%s/%c-l%dd%df%d", pdir, type, level, dir, file);
|
||||
size_t size = sizeof (fdname);
|
||||
if (snprintf(fdname, size, "%s/%c-l%dd%df%d", pdir, type, level, dir,
|
||||
file) >= size) {
|
||||
(void) fprintf(stderr, "fdname truncated\n");
|
||||
exit(EINVAL);
|
||||
}
|
||||
return (fdname);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user