]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
2002-05-20 Yoshinori K. Okuji <okuji@enbug.org>
authorokuji <okuji@localhost>
Mon, 20 May 2002 11:48:03 +0000 (11:48 +0000)
committerokuji <okuji@localhost>
Mon, 20 May 2002 11:48:03 +0000 (11:48 +0000)
* 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.

ChangeLog
lib/device.c
util/grub-install.in

index 5855a3e6ff98f8116ae520ab3a314cb13df83f4b..666b14e91863e65c5f34a4daa57a58cc9fd319cd 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2002-05-20  Yoshinori K. Okuji  <okuji@enbug.org>
+
+       * 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  <okuji@enbug.org>
 
        * lib/device.c: Don't include linux/hdreg.h, linux/major.h,
index f130cad8f194a4d7ba9a06477e3339f05fce1810..72903c9eb8c036d05d4069fba988c5958ad603d4 100644 (file)
@@ -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]);
index 21df9eb5122ca90d17c919d60157db001f616340..e024cd37656d4d0ace7a9fd4dba43542c5fa9f7d 100644 (file)
@@ -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/*)