1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
|
From 8dac421210d9f0b49ac39287ace471a45faab352 Mon Sep 17 00:00:00 2001
From: Michael Forney <mforney@mforney.org>
Date: Mon, 24 Jun 2019 22:48:57 -0700
Subject: [PATCH] Avoid initialization of flexible array in struct
---
disk-utils/fdisk-menu.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/disk-utils/fdisk-menu.c b/disk-utils/fdisk-menu.c
index cd104e20b..58abb16a6 100644
--- a/disk-utils/fdisk-menu.c
+++ b/disk-utils/fdisk-menu.c
@@ -37,7 +37,7 @@ struct menu {
const struct menu *,
const struct menu_entry *);
- struct menu_entry entries[]; /* NULL terminated array */
+ struct menu_entry *entries; /* NULL terminated array */
};
struct menu_context {
@@ -93,7 +93,7 @@ DECLARE_MENU_CB(generic_menu_cb);
/* Generic menu */
static const struct menu menu_generic = {
.callback = generic_menu_cb,
- .entries = {
+ .entries = (struct menu_entry[]){
MENU_BSEP(N_("Generic")),
MENU_ENT ('d', N_("delete a partition")),
MENU_ENT ('F', N_("list free unpartitioned space")),
@@ -133,7 +133,7 @@ static const struct menu menu_createlabel = {
.callback = createlabel_menu_cb,
.exclude = FDISK_DISKLABEL_BSD,
.nonested = 1,
- .entries = {
+ .entries = (struct menu_entry[]){
MENU_SEP(N_("Create a new label")),
MENU_ENT('g', N_("create a new empty GPT partition table")),
MENU_ENT('G', N_("create a new empty SGI (IRIX) partition table")),
@@ -150,7 +150,7 @@ static const struct menu menu_createlabel = {
static const struct menu menu_geo = {
.callback = geo_menu_cb,
.exclude = FDISK_DISKLABEL_GPT | FDISK_DISKLABEL_BSD,
- .entries = {
+ .entries = (struct menu_entry[]){
MENU_XSEP(N_("Geometry (for the current label)")),
MENU_XENT('c', N_("change number of cylinders")),
MENU_XENT('h', N_("change number of heads")),
@@ -162,7 +162,7 @@ static const struct menu menu_geo = {
static const struct menu menu_gpt = {
.callback = gpt_menu_cb,
.label = FDISK_DISKLABEL_GPT,
- .entries = {
+ .entries = (struct menu_entry[]){
MENU_BSEP(N_("GPT")),
MENU_XENT('i', N_("change disk GUID")),
MENU_XENT('n', N_("change partition name")),
@@ -183,7 +183,7 @@ static const struct menu menu_gpt = {
static const struct menu menu_sun = {
.callback = sun_menu_cb,
.label = FDISK_DISKLABEL_SUN,
- .entries = {
+ .entries = (struct menu_entry[]){
MENU_BSEP(N_("Sun")),
MENU_ENT('a', N_("toggle the read-only flag")),
MENU_ENT('c', N_("toggle the mountable flag")),
@@ -200,7 +200,7 @@ static const struct menu menu_sun = {
static const struct menu menu_sgi = {
.callback = sgi_menu_cb,
.label = FDISK_DISKLABEL_SGI,
- .entries = {
+ .entries = (struct menu_entry[]){
MENU_SEP(N_("SGI")),
MENU_ENT('a', N_("select bootable partition")),
MENU_ENT('b', N_("edit bootfile entry")),
@@ -213,7 +213,7 @@ static const struct menu menu_sgi = {
static const struct menu menu_dos = {
.callback = dos_menu_cb,
.label = FDISK_DISKLABEL_DOS,
- .entries = {
+ .entries = (struct menu_entry[]){
MENU_BSEP(N_("DOS (MBR)")),
MENU_ENT('a', N_("toggle a bootable flag")),
MENU_ENT('b', N_("edit nested BSD disklabel")),
@@ -231,7 +231,7 @@ static const struct menu menu_dos = {
static const struct menu menu_bsd = {
.callback = bsd_menu_cb,
.label = FDISK_DISKLABEL_BSD,
- .entries = {
+ .entries = (struct menu_entry[]){
MENU_SEP(N_("BSD")),
MENU_ENT('e', N_("edit drive data")),
MENU_ENT('i', N_("install bootstrap")),
--
2.22.0
|