Package: attr / 1:2.4.48-4

0008-attr_multi-attr_multif-Don-t-set-errno-to-EINVAL.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
From 384983af853bd800c3ddf2a4f8004967888fda8d Mon Sep 17 00:00:00 2001
From: Andreas Gruenbacher <agruenba@redhat.com>
Date: Mon, 17 Dec 2018 14:33:55 +0100
Subject: [PATCH 8/9] 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,
-- 
2.21.0.rc2.261.ga7da99ff1b