Hello,

in util-linux/fdisk.c, the macro

#define INIT_G() do { \
    PTR_TO_GLOBALS = xzalloc(sizeof(G)); \
    sector_size = DEFAULT_SECTOR_SIZE; \
    sector_offset = 1; \
    g_partitions = 4; \
    display_in_cyl_units = 1; \
    units_per_sector = 1; \
} while (0)

seems to get partly optimized away in my gcc (GCC) 3.2.2.
I get a segmentation fault and it turns out that ptr_to_globals is 0.

Rewriting the macro to

#define INIT_G() ( \
    PTR_TO_GLOBALS = xzalloc(sizeof(G)), \
    sector_size = DEFAULT_SECTOR_SIZE, \
    sector_offset = 1, \
    g_partitions = 4, \
    display_in_cyl_units = 1, \
    units_per_sector = 1)

works fine...

  Detlef

-- 
Detlef Vollmann   vollmann engineering gmbh
Linux and C++ for Embedded Systems    http://www.vollmann.ch/
_______________________________________________
busybox mailing list
[email protected]
http://busybox.net/cgi-bin/mailman/listinfo/busybox

Reply via email to