summaryrefslogtreecommitdiff
path: root/util-linux/fdisk.c
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2006-12-30 18:42:29 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2006-12-30 18:42:29 +0000
commit6a5dc5d75a1368464fc7e085aa1f1d4c453d27cd (patch)
treed270e6fa41ae3b327aaef60a956328961795594a /util-linux/fdisk.c
parent3bba545a54addf59b63a003e7ada03fd8b29b5ba (diff)
downloadbusybox-w32-6a5dc5d75a1368464fc7e085aa1f1d4c453d27cd.tar.gz
busybox-w32-6a5dc5d75a1368464fc7e085aa1f1d4c453d27cd.tar.bz2
busybox-w32-6a5dc5d75a1368464fc7e085aa1f1d4c453d27cd.zip
next bunch of fixes for bugs found by randconfig
Diffstat (limited to 'util-linux/fdisk.c')
-rw-r--r--util-linux/fdisk.c30
1 files changed, 16 insertions, 14 deletions
diff --git a/util-linux/fdisk.c b/util-linux/fdisk.c
index 64ebb60e3..27b041e8e 100644
--- a/util-linux/fdisk.c
+++ b/util-linux/fdisk.c
@@ -257,7 +257,7 @@ set_changed(int i)
257{ 257{
258 ptes[i].changed = 1; 258 ptes[i].changed = 1;
259} 259}
260#endif /* CONFIG_FEATURE_FDISK_WRITABLE */ 260#endif /* FEATURE_FDISK_WRITABLE */
261 261
262static ATTRIBUTE_ALWAYS_INLINE struct partition * 262static ATTRIBUTE_ALWAYS_INLINE struct partition *
263get_part_table(int i) 263get_part_table(int i)
@@ -344,7 +344,7 @@ read_hex(const struct systypes *sys)
344 return v; 344 return v;
345 } 345 }
346} 346}
347#endif /* CONFIG_FEATURE_FDISK_WRITABLE */ 347#endif /* FEATURE_FDISK_WRITABLE */
348 348
349#include "fdisk_aix.c" 349#include "fdisk_aix.c"
350 350
@@ -418,7 +418,9 @@ STATIC_SGI int sgi_get_sysid(int i);
418STATIC_SGI void sgi_delete_partition(int i); 418STATIC_SGI void sgi_delete_partition(int i);
419STATIC_SGI void sgi_change_sysid(int i, int sys); 419STATIC_SGI void sgi_change_sysid(int i, int sys);
420STATIC_SGI void sgi_list_table(int xtra); 420STATIC_SGI void sgi_list_table(int xtra);
421#if ENABLE_FEATURE_FDISK_ADVANCED
421STATIC_SGI void sgi_set_xcyl(void); 422STATIC_SGI void sgi_set_xcyl(void);
423#endif
422STATIC_SGI int verify_sgi(int verbose); 424STATIC_SGI int verify_sgi(int verbose);
423STATIC_SGI void sgi_add_partition(int n, int sys); 425STATIC_SGI void sgi_add_partition(int n, int sys);
424STATIC_SGI void sgi_set_swappartition(int i); 426STATIC_SGI void sgi_set_swappartition(int i);
@@ -427,21 +429,21 @@ STATIC_SGI void sgi_set_bootfile(const char* aFile);
427STATIC_SGI void create_sgiinfo(void); 429STATIC_SGI void create_sgiinfo(void);
428STATIC_SGI void sgi_write_table(void); 430STATIC_SGI void sgi_write_table(void);
429STATIC_SGI void sgi_set_bootpartition(int i); 431STATIC_SGI void sgi_set_bootpartition(int i);
430
431#include "fdisk_sgi.c" 432#include "fdisk_sgi.c"
432 433
433STATIC_SUN const struct systypes sun_sys_types[]; 434STATIC_SUN const struct systypes sun_sys_types[];
434STATIC_SUN void sun_delete_partition(int i); 435STATIC_SUN void sun_delete_partition(int i);
435STATIC_SUN void sun_change_sysid(int i, int sys); 436STATIC_SUN void sun_change_sysid(int i, int sys);
436STATIC_SUN void sun_list_table(int xtra); 437STATIC_SUN void sun_list_table(int xtra);
437STATIC_SUN void sun_set_xcyl(void);
438STATIC_SUN void add_sun_partition(int n, int sys); 438STATIC_SUN void add_sun_partition(int n, int sys);
439#if ENABLE_FEATURE_FDISK_ADVANCED
439STATIC_SUN void sun_set_alt_cyl(void); 440STATIC_SUN void sun_set_alt_cyl(void);
440STATIC_SUN void sun_set_ncyl(int cyl); 441STATIC_SUN void sun_set_ncyl(int cyl);
441STATIC_SUN void sun_set_xcyl(void); 442STATIC_SUN void sun_set_xcyl(void);
442STATIC_SUN void sun_set_ilfact(void); 443STATIC_SUN void sun_set_ilfact(void);
443STATIC_SUN void sun_set_rspeed(void); 444STATIC_SUN void sun_set_rspeed(void);
444STATIC_SUN void sun_set_pcylcount(void); 445STATIC_SUN void sun_set_pcylcount(void);
446#endif
445STATIC_SUN void toggle_sunflags(int i, unsigned char mask); 447STATIC_SUN void toggle_sunflags(int i, unsigned char mask);
446STATIC_SUN void verify_sun(void); 448STATIC_SUN void verify_sun(void);
447STATIC_SUN void sun_write_table(void); 449STATIC_SUN void sun_write_table(void);
@@ -564,7 +566,7 @@ store4_little_endian(unsigned char *cp, unsigned val)
564 cp[2] = val >> 16; 566 cp[2] = val >> 16;
565 cp[3] = val >> 24; 567 cp[3] = val >> 24;
566} 568}
567#endif /* CONFIG_FEATURE_FDISK_WRITABLE */ 569#endif /* FEATURE_FDISK_WRITABLE */
568 570
569static unsigned 571static unsigned
570read4_little_endian(const unsigned char *cp) 572read4_little_endian(const unsigned char *cp)
@@ -784,7 +786,7 @@ menu(void)
784#endif 786#endif
785 } 787 }
786} 788}
787#endif /* CONFIG_FEATURE_FDISK_WRITABLE */ 789#endif /* FEATURE_FDISK_WRITABLE */
788 790
789 791
790#if ENABLE_FEATURE_FDISK_ADVANCED 792#if ENABLE_FEATURE_FDISK_ADVANCED
@@ -873,7 +875,7 @@ get_sys_types(void)
873} 875}
874#else 876#else
875#define get_sys_types() i386_sys_types 877#define get_sys_types() i386_sys_types
876#endif /* CONFIG_FEATURE_FDISK_WRITABLE */ 878#endif /* FEATURE_FDISK_WRITABLE */
877 879
878static const char *partition_type(unsigned char type) 880static const char *partition_type(unsigned char type)
879{ 881{
@@ -921,7 +923,7 @@ void list_types(const struct systypes *sys)
921 } while (done < last[0]); 923 } while (done < last[0]);
922 putchar('\n'); 924 putchar('\n');
923} 925}
924#endif /* CONFIG_FEATURE_FDISK_WRITABLE */ 926#endif /* FEATURE_FDISK_WRITABLE */
925 927
926static int 928static int
927is_cleared_partition(const struct partition *p) 929is_cleared_partition(const struct partition *p)
@@ -1149,7 +1151,7 @@ create_doslabel(void)
1149 set_changed(0); 1151 set_changed(0);
1150 get_boot(create_empty_dos); 1152 get_boot(create_empty_dos);
1151} 1153}
1152#endif /* CONFIG_FEATURE_FDISK_WRITABLE */ 1154#endif /* FEATURE_FDISK_WRITABLE */
1153 1155
1154static void 1156static void
1155get_sectorsize(void) 1157get_sectorsize(void)
@@ -1348,7 +1350,7 @@ get_boot(enum action what)
1348#endif 1350#endif
1349 1351
1350 if (!valid_part_table_flag(MBRbuffer)) { 1352 if (!valid_part_table_flag(MBRbuffer)) {
1351#ifndef CONFIG_FEATURE_FDISK_WRITABLE 1353#if !ENABLE_FEATURE_FDISK_WRITABLE
1352 return -1; 1354 return -1;
1353#else 1355#else
1354 switch (what) { 1356 switch (what) {
@@ -1374,7 +1376,7 @@ get_boot(enum action what)
1374 default: 1376 default:
1375 bb_error_msg_and_die(_("internal error")); 1377 bb_error_msg_and_die(_("internal error"));
1376 } 1378 }
1377#endif /* CONFIG_FEATURE_FDISK_WRITABLE */ 1379#endif /* FEATURE_FDISK_WRITABLE */
1378 } 1380 }
1379 1381
1380#if ENABLE_FEATURE_FDISK_WRITABLE 1382#if ENABLE_FEATURE_FDISK_WRITABLE
@@ -1769,7 +1771,7 @@ change_sysid(void)
1769 } 1771 }
1770 } 1772 }
1771} 1773}
1772#endif /* CONFIG_FEATURE_FDISK_WRITABLE */ 1774#endif /* FEATURE_FDISK_WRITABLE */
1773 1775
1774 1776
1775/* check_consistency() and linear2chs() added Sat Mar 6 12:28:16 1993, 1777/* check_consistency() and linear2chs() added Sat Mar 6 12:28:16 1993,
@@ -2517,7 +2519,7 @@ reread_partition_table(int leave)
2517 exit(i != 0); 2519 exit(i != 0);
2518 } 2520 }
2519} 2521}
2520#endif /* CONFIG_FEATURE_FDISK_WRITABLE */ 2522#endif /* FEATURE_FDISK_WRITABLE */
2521 2523
2522#if ENABLE_FEATURE_FDISK_ADVANCED 2524#if ENABLE_FEATURE_FDISK_ADVANCED
2523#define MAX_PER_LINE 16 2525#define MAX_PER_LINE 16
@@ -3035,5 +3037,5 @@ int fdisk_main(int argc, char **argv)
3035 } 3037 }
3036 } 3038 }
3037 return 0; 3039 return 0;
3038#endif /* CONFIG_FEATURE_FDISK_WRITABLE */ 3040#endif /* FEATURE_FDISK_WRITABLE */
3039} 3041}