summaryrefslogtreecommitdiffstats
path: root/sys-utils/lsns.c
diff options
context:
space:
mode:
authorYuriy M. Kaminskiy2016-02-27 17:14:44 +0100
committerKarel Zak2016-03-07 15:11:06 +0100
commitff27b20f3ce74043d512522f28af59050c25541b (patch)
treef70a4278cf80b90e1827190f9124fdc1c2bebc54 /sys-utils/lsns.c
parentlscpu: fix backward buffer size adjustment after adding delimiter (diff)
downloadkernel-qcow2-util-linux-ff27b20f3ce74043d512522f28af59050c25541b.tar.gz
kernel-qcow2-util-linux-ff27b20f3ce74043d512522f28af59050c25541b.tar.xz
kernel-qcow2-util-linux-ff27b20f3ce74043d512522f28af59050c25541b.zip
lsns.c: fix error return
If non-negative value returned, errno could be unset (especially 0). Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'sys-utils/lsns.c')
-rw-r--r--sys-utils/lsns.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/sys-utils/lsns.c b/sys-utils/lsns.c
index 71ae3f99e..83b07f5a8 100644
--- a/sys-utils/lsns.c
+++ b/sys-utils/lsns.c
@@ -255,7 +255,7 @@ static int read_process(struct lsns *ls, pid_t pid)
}
rc = fscanf(f, "%d %*s %c %d*[^\n]", &p->pid, &p->state, &p->ppid);
if (rc != 3) {
- rc = -errno;
+ rc = rc < 0 ? -errno : -EINVAL;
goto done;
}
rc = 0;