logo

oasis

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

0005-Avoid-initialization-of-flexible-array-in-struct.patch (3467B)


  1. From ebf2fe8b09eb71a148800bdae671dfb00befc02c 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 4e5801bce..979f32e83 100644
  10. --- a/disk-utils/fdisk-menu.c
  11. +++ b/disk-utils/fdisk-menu.c
  12. @@ -46,7 +46,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. @@ -101,7 +101,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. @@ -145,7 +145,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. @@ -162,7 +162,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. @@ -174,7 +174,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. @@ -195,7 +195,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. @@ -212,7 +212,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. @@ -225,7 +225,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. @@ -244,7 +244,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.49.0