]> git.wh0rd.org - patches.git/blame - util-linux-fdisk-check-change-return.patch
more random patches. who knows.
[patches.git] / util-linux-fdisk-check-change-return.patch
CommitLineData
5e993f12 1diff --git a/fdisk/fdisk.c b/fdisk/fdisk.c
2index 292b7a8..56ea38d 100644
3--- a/fdisk/fdisk.c
4+++ b/fdisk/fdisk.c
5@@ -1414,17 +1414,21 @@ change_sysid(void) {
6 if (sys == origsys)
7 break;
8 if (sun_label) {
9- sun_change_sysid(i, sys);
10+ ptes[i].changed = sun_change_sysid(i, sys);
11 } else
12 if (sgi_label) {
13- sgi_change_sysid(i, sys);
14- } else
15+ ptes[i].changed = sgi_change_sysid(i, sys);
16+ } else {
17 p->sys_ind = sys;
18- printf (_("Changed system type of partition %d "
19- "to %x (%s)\n"), i + 1, sys,
20- (temp = partition_type(sys)) ? temp :
21- _("Unknown"));
22- ptes[i].changed = 1;
23+ ptes[i].changed = 1;
24+ }
25+ temp = partition_type(sys) ? : _("Unknown");
26+ if (ptes[i].changed)
27+ printf (_("Changed system type of partition %d "
28+ "to %x (%s)\n"), i + 1, sys, temp);
29+ else
30+ printf (_("System type of partition %d is unchanged"
31+ "to %x (%s)\n"), i + 1, sys, temp);
32 if (is_dos_partition(origsys) ||
33 is_dos_partition(sys))
34 dos_changed = 1;
35diff --git a/fdisk/fdisksgilabel.c b/fdisk/fdisksgilabel.c
36index e1b3829..7e189fb 100644
37--- a/fdisk/fdisksgilabel.c
38+++ b/fdisk/fdisksgilabel.c
39@@ -537,12 +537,12 @@ verify_sgi(int verbose)
40 return (gap > 0) ? 1 : (gap == 0) ? 0 : -1;
41 }
42
43-void
44+int
45 sgi_change_sysid(int i, int sys)
46 {
47 if (sgi_get_num_sectors(i) == 0) /* caught already before, ... */ {
48 printf(_("Sorry You may change the Tag of non-empty partitions.\n"));
49- return;
50+ return 0;
51 }
52 if (((sys != ENTIRE_DISK) && (sys != SGI_VOLHDR))
53 && (sgi_get_start_sector(i)<1)) {
54@@ -553,9 +553,10 @@ sgi_change_sysid(int i, int sys)
55 "Only the \"SGI volume\" entire disk section may violate this.\n"
56 "Type YES if you are sure about tagging this partition differently.\n"));
57 if (strcmp (line_ptr, _("YES\n")))
58- return;
59+ return 0;
60 }
61 sgilabel->partitions[i].id = SSWAP32(sys);
62+ return 1;
63 }
64
65 /* returns partition index of first entry marked as entire disk */
66diff --git a/fdisk/fdisksgilabel.h b/fdisk/fdisksgilabel.h
67index fe757bf..02b3e9d 100644
68--- a/fdisk/fdisksgilabel.h
69+++ b/fdisk/fdisksgilabel.h
70@@ -112,7 +112,7 @@ extern struct systypes sgi_sys_types[];
71 extern void sgi_nolabel( void );
72 extern int check_sgi_label( void );
73 extern void sgi_list_table( int xtra );
74-extern void sgi_change_sysid( int i, int sys );
75+extern int sgi_change_sysid( int i, int sys );
76 extern unsigned int sgi_get_start_sector( int i );
77 extern unsigned int sgi_get_num_sectors( int i );
78 extern int sgi_get_sysid( int i );
79diff --git a/fdisk/fdisksunlabel.c b/fdisk/fdisksunlabel.c
80index f67aa26..60ade06 100644
81--- a/fdisk/fdisksunlabel.c
82+++ b/fdisk/fdisksunlabel.c
83@@ -530,7 +530,7 @@ void sun_delete_partition(int i)
84 part->num_sectors = 0;
85 }
86
87-void sun_change_sysid(int i, __u16 sys)
88+int sun_change_sysid(int i, __u16 sys)
89 {
90 struct sun_partition *part = &sunlabel->partitions[i];
91 struct sun_tag_flag *tag = &sunlabel->part_tags[i];
92@@ -543,7 +543,7 @@ void sun_change_sysid(int i, __u16 sys)
93 "Type YES if you're very sure you would like that partition\n"
94 "tagged with 82 (Linux swap): "));
95 if (strcmp (line_ptr, _("YES\n")))
96- return;
97+ return 0;
98 }
99 switch (sys) {
100 case SUN_TAG_SWAP:
101@@ -558,6 +558,7 @@ void sun_change_sysid(int i, __u16 sys)
102 break;
103 }
104 tag->tag = SSWAP16(sys);
105+ return 1;
106 }
107
108 void sun_list_table(int xtra)
109diff --git a/fdisk/fdisksunlabel.h b/fdisk/fdisksunlabel.h
110index c8e0698..fba67f7 100644
111--- a/fdisk/fdisksunlabel.h
112+++ b/fdisk/fdisksunlabel.h
113@@ -82,7 +82,7 @@ extern int check_sun_label(void);
114 extern void sun_nolabel(void);
115 extern void create_sunlabel(void);
116 extern void sun_delete_partition(int i);
117-extern void sun_change_sysid(int i, __u16 sys);
118+extern int sun_change_sysid(int i, __u16 sys);
119 extern void sun_list_table(int xtra);
120 extern void verify_sun(void);
121 extern void add_sun_partition(int n, int sys);