logo

oasis

Own branch of Oasis Linux (upstream: <https://git.sr.ht/~mcf/oasis/>) git clone https://anongit.hacktivis.me/git/oasis.git

0006-Avoid-initialization-of-flexible-array-in-struct.patch (3465B)


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