Fix doxygen doc for libcryptsetup.h.
[platform/upstream/cryptsetup.git] / lib / libdevmapper.c
index 5d3a605..9fd01b4 100644 (file)
@@ -8,7 +8,8 @@
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
- * version 2 as published by the Free Software Foundation.
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
  *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -695,6 +696,14 @@ int dm_status_device(struct crypt_device *cd, const char *name)
 {
        int r;
        struct dm_info dmi;
+       struct stat st;
+
+       /* libdevmapper is too clever and handles
+        * path argument differenly with error.
+        * Fail early here if parameter is non-existent path.
+        */
+       if (strchr(name, '/') && stat(name, &st) < 0)
+               return -ENODEV;
 
        if (dm_init_context(cd))
                return -ENOTSUP;