projects
/
rrq
/
maintain_lilo.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Imported Upstream version 23.2
[rrq/maintain_lilo.git]
/
src
/
device.c
diff --git
a/src/device.c
b/src/device.c
index fb7a9f77d50c413501d4eb0eb85cd50d6a12a745..2a5c8ff657aeceda0bde0dc4f41e36e5b2930684 100644
(file)
--- a/
src/device.c
+++ b/
src/device.c
@@
-197,6
+197,7
@@
int dev_open(DEVICE *dev,int number,int flags)
char name[PATH_MAX];
ST_BUF st;
int count;
char name[PATH_MAX];
ST_BUF st;
int count;
+ int err;
if (lookup_dev(name,dev,number)) dev->delete = 0;
else {
if (lookup_dev(name,dev,number)) dev->delete = 0;
else {
@@
-235,11
+236,12
@@
int dev_open(DEVICE *dev,int number,int flags)
#endif
if (flags == O_BYPASS) dev->fd = -1;
else if ((dev->fd = open(name,flags)) < 0) {
#endif
if (flags == O_BYPASS) dev->fd = -1;
else if ((dev->fd = open(name,flags)) < 0) {
- fprintf (errstd, "Cannot proceed. Maybe you need to add "
+ err = errno;
+ fprintf (errstd, "Cannot proceed. Maybe you need to add "
"this to your lilo.conf:\n"
"\tdisk=%s inaccessible\n"
"(real error shown below)\n", name);
"this to your lilo.conf:\n"
"\tdisk=%s inaccessible\n"
"(real error shown below)\n", name);
- die("open %s: %s",name,strerror(err
no
));
+ die("open %s: %s",name,strerror(err));
}
dev->name = stralloc(name);
return dev->fd;
}
dev->name = stralloc(name);
return dev->fd;
@@
-639,7
+641,7
@@
unsigned int register_bios(int bios, int device)
*(int*)&buff.sector[PART_TABLE_OFFSET-6] = serial;
if (*(short*)&buff.sector[PART_TABLE_OFFSET - 2] == 0)
*(int*)&buff.sector[PART_TABLE_OFFSET-6] = serial;
if (*(short*)&buff.sector[PART_TABLE_OFFSET - 2] == 0)
- *(short*)&buff.sector[PART_TABLE_OFFSET - 2] = MAGIC_SERIAL;
+ *(
unsigned
short*)&buff.sector[PART_TABLE_OFFSET - 2] = MAGIC_SERIAL;
if (verbose)
printf("Assigning new Volume ID to (%04X) '%s' ID = %08X\n",
device, dev.name, (int)serial);
if (verbose)
printf("Assigning new Volume ID to (%04X) '%s' ID = %08X\n",
device, dev.name, (int)serial);
@@
-655,7
+657,7
@@
unsigned int register_bios(int bios, int device)
if (device_code[i]==device)
die("register_bios: device code duplicated: %04X", device);
if (serial_no[i]==serial)
if (device_code[i]==device)
die("register_bios: device code duplicated: %04X", device);
if (serial_no[i]==serial)
- die("register_bios: volume ID serial no. duplicated: %08
l
X", serial);
+ die("register_bios: volume ID serial no. duplicated: %08X", serial);
}
device_code[bios] = device;
serial_no[bios] = serial;
}
device_code[bios] = device;
serial_no[bios] = serial;
@@
-714,11
+716,11
@@
static int volid_get_set(int device, int vol_in, int option)
fd = dev_open(&dev, device, option ? O_RDWR : O_RDONLY);
if (read(fd, &buf, sizeof(buf)) != sizeof(buf)) {
fd = dev_open(&dev, device, option ? O_RDWR : O_RDONLY);
if (read(fd, &buf, sizeof(buf)) != sizeof(buf)) {
-
fprintf (errstd, "Cannot proceed. Maybe you need to add "
+ fprintf (errstd, "Cannot proceed. Maybe you need to add "
"this to your lilo.conf:\n"
"\tdisk=%s inaccessible\n"
"(real error shown below)\n", dev.name);
"this to your lilo.conf:\n"
"\tdisk=%s inaccessible\n"
"(real error shown below)\n", dev.name);
-
die("VolumeID read error: sector 0 of %s not readable", dev.name);
+ die("VolumeID read error: sector 0 of %s not readable", dev.name);
}
if (option==ID_SET) {
make_backup(NULL, 0, &buf, device,
}
if (option==ID_SET) {
make_backup(NULL, 0, &buf, device,