diff options
author | Karel Zak <kzak@redhat.com> | 2013-04-03 13:32:39 +0200 |
---|---|---|
committer | Karel Zak <kzak@redhat.com> | 2013-04-03 13:32:39 +0200 |
commit | 4e5262e450a7ca2835d6c64edef8df0ad24f75a9 (patch) | |
tree | 9f1ae7c613600f11fac321b0215dcdfcff5fd010 /lib | |
parent | 39de73f5f1c15c8acc5285a0162b43888354e6aa (diff) | |
download | util-linux-4e5262e450a7ca2835d6c64edef8df0ad24f75a9.tar.gz |
lib/canonicalize: don't use /dev/mapper/<name> if the node does not exist
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/canonicalize.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/canonicalize.c b/lib/canonicalize.c index 1e8aff4f..b70acd18 100644 --- a/lib/canonicalize.c +++ b/lib/canonicalize.c @@ -159,7 +159,9 @@ canonicalize_dm_name(const char *ptname) if (fgets(name, sizeof(name), f) && (sz = strlen(name)) > 1) { name[sz - 1] = '\0'; snprintf(path, sizeof(path), "/dev/mapper/%s", name); - res = strdup(path); + + if (access(path, F_OK) == 0) + res = strdup(path); } fclose(f); return res; |