diff options
author | Yuriy M. Kaminskiy | 2016-02-27 17:14:44 +0100 |
---|---|---|
committer | Karel Zak | 2016-03-07 15:11:06 +0100 |
commit | ff27b20f3ce74043d512522f28af59050c25541b (patch) | |
tree | f70a4278cf80b90e1827190f9124fdc1c2bebc54 /lib/sysfs.c | |
parent | lscpu: fix backward buffer size adjustment after adding delimiter (diff) | |
download | kernel-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 'lib/sysfs.c')
-rw-r--r-- | lib/sysfs.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/sysfs.c b/lib/sysfs.c index 53aba3af9..9d7614880 100644 --- a/lib/sysfs.c +++ b/lib/sysfs.c @@ -464,7 +464,7 @@ int sysfs_write_u64(struct sysfs_cxt *cxt, const char *attr, uint64_t num) len = snprintf(buf, sizeof(buf), "%" PRIu64, num); if (len < 0 || (size_t) len + 1 > sizeof(buf)) - rc = -errno; + rc = len < 0 ? -errno : -E2BIG; else rc = write_all(fd, buf, len); |