From: Karel Zak Date: Mon, 28 May 2012 10:26:36 +0000 (+0200) Subject: libmount: add MNT_ERR_LOOPDEV X-Git-Tag: v2.22-rc1~364 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=82756a747e4bcfc13a27b7618d889af080649584;p=thirdparty%2Futil-linux.git libmount: add MNT_ERR_LOOPDEV Signed-off-by: Karel Zak --- diff --git a/lib/loopdev.c b/lib/loopdev.c index fd3f9bae5d..c0f701896f 100644 --- a/lib/loopdev.c +++ b/lib/loopdev.c @@ -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; } /* diff --git a/libmount/src/context_loopdev.c b/libmount/src/context_loopdev.c index 023c9529be..0dcf5803e0 100644 --- a/libmount/src/context_loopdev.c +++ b/libmount/src/context_loopdev.c @@ -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")); diff --git a/libmount/src/libmount.h.in b/libmount/src/libmount.h.in index e11c0c09c0..5161cf7c9d 100644 --- a/libmount/src/libmount.h.in +++ b/libmount/src/libmount.h.in @@ -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);