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