Skip to content

Commit b8523a4

Browse files
committed
GCC 15: Fix unterminated-string-initialization
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 are not meant to be NULL terminated. Closes: openzfs#17242 Signed-off-by: Tony Hutter <[email protected]>
1 parent 131df3b commit b8523a4

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

cmd/zpool/os/linux/zpool_vdev_os.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@
8888

8989
typedef struct vdev_disk_db_entry
9090
{
91-
char id[24];
91+
char id[24] __attribute__((nonstring));
9292
int sector_size;
9393
} vdev_disk_db_entry_t;
9494

module/zcommon/zfs_valstr.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
*/
4040
typedef struct {
4141
const char vb_bit;
42-
const char vb_pair[2];
42+
const char vb_pair[2] __attribute__((nonstring));
4343
const char *vb_name;
4444
} valstr_bit_t;
4545

tests/zfs-tests/cmd/file/largest_file.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ main(int argc, char **argv)
6262
offset_t llseek_ret = 0;
6363
int write_ret = 0;
6464
int err = 0;
65-
char mybuf[5] = "aaaa\0";
65+
char mybuf[5] = "aaaa";
6666
char *testfile;
6767
mode_t mode = S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH;
6868
struct sigaction sa;

0 commit comments

Comments
 (0)