aboutsummaryrefslogtreecommitdiffstats
path: root/lib/blkid
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>2008-06-28 21:02:01 -0400
committerTheodore Ts'o <tytso@mit.edu>2008-06-28 22:17:43 -0400
commitb697f9d01c5f07842426f7d8e918bf3110028662 (patch)
treef4929bb271c87e249c37142af0486a8f4a068f61 /lib/blkid
parent772b89d34212e4b36c2025c80304e166bc25a2f3 (diff)
downloadandroid_external_e2fsprogs-b697f9d01c5f07842426f7d8e918bf3110028662.tar.gz
android_external_e2fsprogs-b697f9d01c5f07842426f7d8e918bf3110028662.tar.bz2
android_external_e2fsprogs-b697f9d01c5f07842426f7d8e918bf3110028662.zip
blkid: Make sure a device returned by blkid_find_dev_with_tag exists
There could be stale entries in blkid file, so if the device does not exist, skip it. Addresses-Debian-Bug: #487758, #487783 Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'lib/blkid')
-rw-r--r--lib/blkid/tag.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/blkid/tag.c b/lib/blkid/tag.c
index 44dd86d5..8a8ac990 100644
--- a/lib/blkid/tag.c
+++ b/lib/blkid/tag.c
@@ -10,6 +10,7 @@
* %End-Header%
*/
+#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
@@ -355,7 +356,8 @@ try_again:
bit_names);
if (!strcmp(tmp->bit_val, value) &&
- tmp->bit_dev->bid_pri > pri) {
+ (tmp->bit_dev->bid_pri > pri) &&
+ !access(tmp->bit_dev->bid_name, F_OK)) {
dev = tmp->bit_dev;
pri = dev->bid_pri;
}
@@ -363,7 +365,7 @@ try_again:
}
if (dev && !(dev->bid_flags & BLKID_BID_FL_VERIFIED)) {
dev = blkid_verify(cache, dev);
- if (dev && (dev->bid_flags & BLKID_BID_FL_VERIFIED))
+ if (!dev || (dev && (dev->bid_flags & BLKID_BID_FL_VERIFIED)))
goto try_again;
}