attr/0002-attr_multi-attr_multif-Don-t-set-errno-to-EINVAL.patch

38 lines
1.1 KiB
Diff
Raw Normal View History

From c6b3d77b1c52af927ddf34230505e4b7d4df0960 Mon Sep 17 00:00:00 2001
From: Andreas Gruenbacher <agruenba@redhat.com>
Date: Mon, 17 Dec 2018 14:33:55 +0100
Subject: [PATCH 2/7] attr_multi, attr_multif: Don't set errno to -EINVAL
When attr_multi or attr_multif are called with an invalid am_opcode,
they fail with errno set to -EINVAL. Instead, the errno value should be
positive.
---
libattr/libattr.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libattr/libattr.c b/libattr/libattr.c
index d6668af..8180c3f 100644
--- a/libattr/libattr.c
+++ b/libattr/libattr.c
@@ -391,7 +391,7 @@ attr_single(const char *path, attr_multiop_t *op, int flags)
{
int r = -1;
- errno = -EINVAL;
+ errno = EINVAL;
flags |= op->am_flags;
if (op->am_opcode == ATTR_OP_GET)
r = attr_get(path, op->am_attrname, op->am_attrvalue,
@@ -409,7 +409,7 @@ attr_singlef(const int fd, attr_multiop_t *op, int flags)
{
int r = -1;
- errno = -EINVAL;
+ errno = EINVAL;
flags |= op->am_flags;
if (op->am_opcode == ATTR_OP_GET)
r = attr_getf(fd, op->am_attrname, op->am_attrvalue,
--
1.8.3.1