mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-31 11:14:09 +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
@@ -30,13 +30,16 @@ main(int argc, char *argv[])
|
||||
struct sockaddr_un sock;
|
||||
int fd;
|
||||
char *path;
|
||||
|
||||
size_t size;
|
||||
if (argc != 2) {
|
||||
fprintf(stderr, "usage: %s /path/to/socket\n", argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
path = argv[1];
|
||||
strncpy(sock.sun_path, (char *)path, sizeof (sock.sun_path));
|
||||
size = sizeof (sock.sun_path);
|
||||
strncpy(sock.sun_path, (char *)path, size - 1);
|
||||
sock.sun_path[size - 1] = '\0';
|
||||
|
||||
sock.sun_family = AF_UNIX;
|
||||
if ((fd = socket(AF_UNIX, SOCK_DGRAM, 0)) == -1) {
|
||||
perror("socket");
|
||||
|
||||
Reference in New Issue
Block a user