summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkarthik-us <ksubrahm@redhat.com>2017-11-30 18:39:58 +0530
committerJeff Darcy <jeff@pl.atyp.us>2017-12-07 15:15:15 +0000
commitd9e9e76188b839447de1d7bdf415a820f13b971b (patch)
treeb737a3a570eca521efe90c926ca32bad1622a106
parent47d01546a1826dc14a8331ea8700015f1cfdc4db (diff)
features/read-only: Coverity fixes
Warning File Function NEGATIVE_RETURNS worm.c worm_writev RESOURCE_LEAK worm.c init read-only.c init Note: COPY_PASTE_ERROR in worm_setattr & worm_fsetattr are false alarms. Change-Id: Iba1b0c18137a8797d7d04502acc87f0b307e1a1c BUG: 789278 Signed-off-by: karthik-us <ksubrahm@redhat.com>
-rw-r--r--xlators/features/read-only/src/read-only.c3
-rw-r--r--xlators/features/read-only/src/worm.c8
2 files changed, 8 insertions, 3 deletions
diff --git a/xlators/features/read-only/src/read-only.c b/xlators/features/read-only/src/read-only.c
index d72b2c8fd2b..207b2b1a1d6 100644
--- a/xlators/features/read-only/src/read-only.c
+++ b/xlators/features/read-only/src/read-only.c
@@ -46,9 +46,10 @@ init (xlator_t *this)
if (!priv)
goto out;
+ this->private = priv;
+
GF_OPTION_INIT ("read-only", priv->readonly_or_worm_enabled, bool, out);
- this->private = priv;
ret = 0;
out:
return ret;
diff --git a/xlators/features/read-only/src/worm.c b/xlators/features/read-only/src/worm.c
index d37a930c1fc..088dd5a1b23 100644
--- a/xlators/features/read-only/src/worm.c
+++ b/xlators/features/read-only/src/worm.c
@@ -434,9 +434,12 @@ worm_writev (call_frame_t *frame, xlator_t *this, fd_t *fd,
op_errno = gf_worm_state_transition (this, _gf_true, fd, GF_FOP_WRITE);
out:
- if (op_errno)
+ if (op_errno) {
+ if (op_errno < 0)
+ op_errno = EROFS;
STACK_UNWIND_STRICT (writev, frame, -1, op_errno, NULL, NULL,
NULL);
+ }
else
STACK_WIND_TAIL (frame, FIRST_CHILD (this),
FIRST_CHILD (this)->fops->writev,
@@ -535,6 +538,8 @@ init (xlator_t *this)
goto out;
}
+ this->private = priv;
+
GF_OPTION_INIT ("worm", priv->readonly_or_worm_enabled,
bool, out);
GF_OPTION_INIT ("worm-file-level", priv->worm_file, bool, out);
@@ -545,7 +550,6 @@ init (xlator_t *this)
GF_OPTION_INIT ("worm-files-deletable", priv->worm_files_deletable,
bool, out);
- this->private = priv;
ret = 0;
out:
return ret;