id[0] & 0xff,
(id[0]>>8) & 0xff
);
- pfd = fopen("/proc/scsi/scsi", "r");
+ pfd = fopen_for_read("/proc/scsi/scsi");
if (!pfd) {
return NULL;
}
create_sunlabel(void)
{
struct hd_geometry geometry;
- unsigned int ndiv;
- int i;
+ unsigned ndiv;
unsigned char c;
const struct sun_predefined_drives *p = NULL;
memset(MBRbuffer, 0, sizeof(MBRbuffer));
sunlabel->magic = SUN_SSWAP16(SUN_LABEL_MAGIC);
if (!floppy) {
+ unsigned i;
puts("Drive type\n"
" ? auto configure\n"
" 0 custom (with hardware detected defaults)");
while (ush < (unsigned short *)(&sunlabel->csum))
csum ^= *ush++;
sunlabel->csum = csum;
- if (lseek(dev_fd, 0, SEEK_SET) < 0)
- fdisk_fatal(unable_to_seek);
- if (write(dev_fd, sunlabel, SECTOR_SIZE) != SECTOR_SIZE)
- fdisk_fatal(unable_to_write);
+ write_sector(0, sunlabel);
}
#endif /* SUN_LABEL */