diff --git a/ChangeLog b/ChangeLog index 5855a3e6f..666b14e91 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2002-05-20 Yoshinori K. Okuji + + * lib/device.c (read_device_map): Show an error message and exit + abnormally, if MAP[DRIVE] has already been filled. + * util/grub-install.in: If there is any dulicated entry, print + an error message and exit abnormally. + 2002-05-20 Yoshinori K. Okuji * lib/device.c: Don't include linux/hdreg.h, linux/major.h, diff --git a/lib/device.c b/lib/device.c index f130cad8f..72903c9eb 100644 --- a/lib/device.c +++ b/lib/device.c @@ -454,6 +454,13 @@ read_device_map (FILE *fp, char **map, const char *map_file) while (*eptr && ! isspace (*eptr)) eptr++; *eptr = 0; + + /* Multiple entries for a given drive is not allowed. */ + if (map[drive]) + { + show_error (line_number, "Duplicated entry found"); + return 0; + } map[drive] = strdup (ptr); assert (map[drive]); diff --git a/util/grub-install.in b/util/grub-install.in index 21df9eb51..e024cd376 100644 --- a/util/grub-install.in +++ b/util/grub-install.in @@ -323,6 +323,14 @@ EOF rm -f $log_file fi +# Make sure that there is no duplicated entry. +tmp=`sed -n '/^([fh]d[0-9]*)/s/\(^(.*)\).*/\1/p' $device_map \ + | sort | uniq -d | sed -n 1p` +if test -n "$tmp"; then + echo "The drive $tmp is defined multiple times in the device map $device_map" 1>&2 + exit 1 +fi + # Check for INSTALL_DEVICE. case "$install_device" in /dev/*)