diff options
| author | Karel Zak <kzak@redhat.com> | 2012-05-28 12:26:36 +0200 |
|---|---|---|
| committer | Karel Zak <kzak@redhat.com> | 2012-05-28 12:26:36 +0200 |
| commit | 82756a747e4bcfc13a27b7618d889af080649584 (patch) | |
| tree | 6bfb5688d38e1d571ae6b1a960a0520bf4e1af73 | |
| parent | 3fc480b952aa925710f9f869add09563e2c47787 (diff) | |
| download | util-linux-82756a747e4bcfc13a27b7618d889af080649584.tar.gz | |
libmount: add MNT_ERR_LOOPDEV
Signed-off-by: Karel Zak <kzak@redhat.com>
| -rw-r--r-- | lib/loopdev.c | 4 | ||||
| -rw-r--r-- | libmount/src/context_loopdev.c | 1 | ||||
| -rw-r--r-- | libmount/src/libmount.h.in | 1 |
3 files changed, 6 insertions, 0 deletions
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); |
