diff options
author | Karel Zak | 2017-09-15 14:30:06 +0200 |
---|---|---|
committer | Karel Zak | 2017-09-15 14:30:06 +0200 |
commit | d369dc42cb4974d6a928ae28ed32fa11b528e5fb (patch) | |
tree | ffa3e5f491285c84cc5cad85d73b929917fabc30 /libmount/src/tab_update.c | |
parent | libsmartcols: fix heap-buffer-overflow when move columns (diff) | |
download | kernel-qcow2-util-linux-d369dc42cb4974d6a928ae28ed32fa11b528e5fb.tar.gz kernel-qcow2-util-linux-d369dc42cb4974d6a928ae28ed32fa11b528e5fb.tar.xz kernel-qcow2-util-linux-d369dc42cb4974d6a928ae28ed32fa11b528e5fb.zip |
libmount: export locking errors as MNT_EX_FILEIO
The mount man page assumes locking errors mapped to MNT_EX_FILEIO (16)
return code. Unfortunately, this is internally not exported as a
special error code, so it's returned as a generic (errno based)
stuff. This patch fixes this issue.
Note that we still use locking for example for utab or when enabled
/etc/mtab (disabled by default).
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'libmount/src/tab_update.c')
-rw-r--r-- | libmount/src/tab_update.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/libmount/src/tab_update.c b/libmount/src/tab_update.c index 52e1dd444..e95713301 100644 --- a/libmount/src/tab_update.c +++ b/libmount/src/tab_update.c @@ -696,7 +696,7 @@ static int update_add_entry(struct libmnt_update *upd, struct libmnt_lock *lc) if (lc) rc = mnt_lock_file(lc); if (rc) - return rc; + return -MNT_ERR_LOCK; tb = __mnt_new_table_from_file(upd->filename, upd->userspace_only ? MNT_FMT_UTAB : MNT_FMT_MTAB); @@ -722,7 +722,7 @@ static int update_remove_entry(struct libmnt_update *upd, struct libmnt_lock *lc if (lc) rc = mnt_lock_file(lc); if (rc) - return rc; + return -MNT_ERR_LOCK; tb = __mnt_new_table_from_file(upd->filename, upd->userspace_only ? MNT_FMT_UTAB : MNT_FMT_MTAB); @@ -751,7 +751,7 @@ static int update_modify_target(struct libmnt_update *upd, struct libmnt_lock *l if (lc) rc = mnt_lock_file(lc); if (rc) - return rc; + return -MNT_ERR_LOCK; tb = __mnt_new_table_from_file(upd->filename, upd->userspace_only ? MNT_FMT_UTAB : MNT_FMT_MTAB); @@ -788,7 +788,7 @@ static int update_modify_options(struct libmnt_update *upd, struct libmnt_lock * if (lc) rc = mnt_lock_file(lc); if (rc) - return rc; + return -MNT_ERR_LOCK; tb = __mnt_new_table_from_file(upd->filename, upd->userspace_only ? MNT_FMT_UTAB : MNT_FMT_MTAB); @@ -885,10 +885,13 @@ int mnt_update_already_done(struct libmnt_update *upd, struct libmnt_lock *lc) } if (lc && upd->userspace_only) mnt_lock_use_simplelock(lc, TRUE); /* use flock */ - if (lc) + if (lc) { rc = mnt_lock_file(lc); - if (rc) - goto done; + if (rc) { + rc = -MNT_ERR_LOCK; + goto done; + } + } tb = __mnt_new_table_from_file(upd->filename, upd->userspace_only ? MNT_FMT_UTAB : MNT_FMT_MTAB); |