mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2025-06-10 15:54:57 +03:00
GCC 15: Fix unterminated-string-initialization (#17244)
Fix build errors on Fedora 42 like: module/zcommon/zfs_valstr.c:193:16: error: initializer-string for array of 'char' truncates NUL terminator but destination lacks 'nonstring' attribute (3 chars into 2 available) The arrays in zpool_vdev_os.c and zfs_valstr.c don't need to be NULL terminated, but we do so to make GCC happy. Closes: #17242 Signed-off-by: Tony Hutter <hutter2@llnl.gov> Reviewed-by: Alexander Motin <mav@FreeBSD.org> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
This commit is contained in:
parent
4866c2fabf
commit
155847c72d
@ -88,7 +88,8 @@
|
||||
|
||||
typedef struct vdev_disk_db_entry
|
||||
{
|
||||
char id[24];
|
||||
/* 24 byte name + 1 byte NULL terminator to make GCC happy */
|
||||
char id[25];
|
||||
int sector_size;
|
||||
} vdev_disk_db_entry_t;
|
||||
|
||||
|
@ -39,7 +39,9 @@
|
||||
*/
|
||||
typedef struct {
|
||||
const char vb_bit;
|
||||
const char vb_pair[2];
|
||||
|
||||
/* 2 byte name + 1 byte NULL terminator to make GCC happy */
|
||||
const char vb_pair[3];
|
||||
const char *vb_name;
|
||||
} valstr_bit_t;
|
||||
|
||||
|
@ -62,7 +62,7 @@ main(int argc, char **argv)
|
||||
offset_t llseek_ret = 0;
|
||||
int write_ret = 0;
|
||||
int err = 0;
|
||||
char mybuf[5] = "aaaa\0";
|
||||
char mybuf[5] = "aaaa";
|
||||
char *testfile;
|
||||
mode_t mode = S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH;
|
||||
struct sigaction sa;
|
||||
|
Loading…
Reference in New Issue
Block a user