]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libmount: add MNT_ERR_LOOPDEV
authorKarel Zak <kzak@redhat.com>
Mon, 28 May 2012 10:26:36 +0000 (12:26 +0200)
committerKarel Zak <kzak@redhat.com>
Mon, 28 May 2012 10:26:36 +0000 (12:26 +0200)
Signed-off-by: Karel Zak <kzak@redhat.com>
lib/loopdev.c
libmount/src/context_loopdev.c
libmount/src/libmount.h.in

index fd3f9bae5d9602dd2e4f96cebd6a02574bb18687..c0f701896f650092e17fbd8d3df44ae4f43d6fee 100644 (file)
@@ -173,6 +173,8 @@ int loopcxt_init(struct loopdev_cxt *lc, int flags)
  */
 void loopcxt_deinit(struct loopdev_cxt *lc)
 {
+       int errsv = errno;
+
        if (!lc)
                return;
 
@@ -183,6 +185,8 @@ void loopcxt_deinit(struct loopdev_cxt *lc)
 
        loopcxt_set_device(lc, NULL);
        loopcxt_deinit_iterator(lc);
+
+       errno = errsv;
 }
 
 /*
index 023c9529be6a69dcedef1413e233d4a5e66a14fd..0dcf5803e01dea2ff57a9cff291efc494550c159 100644 (file)
@@ -261,6 +261,7 @@ int mnt_context_setup_loopdev(struct libmnt_context *cxt)
 
                if (loopdev || rc != -EBUSY) {
                        DBG(CXT, mnt_debug_h(cxt, "failed to setup device"));
+                       rc = -MNT_ERR_LOOPDEV;
                        goto done;
                }
                DBG(CXT, mnt_debug_h(cxt, "loopdev stolen...trying again"));
index e11c0c09c01360d0670d9587d70f9a6a299949ab..5161cf7c9d603544046303d9d65a64d2a82ec9f1 100644 (file)
@@ -126,6 +126,7 @@ enum {
 #define MNT_ERR_NOFSTAB      5000      /* not found required entry in fstab */
 #define MNT_ERR_NOFSTYPE     5001      /* failed to detect filesystem type */
 #define MNT_ERR_NOSOURCE     5002      /* required mount source undefined */
+#define MNT_ERR_LOOPDEV             5003       /* loopdev setup failed, errno set by libc */
 
 /* init.c */
 extern void mnt_init_debug(int mask);