From ff27b20f3ce74043d512522f28af59050c25541b Mon Sep 17 00:00:00 2001 From: Yuriy M. Kaminskiy Date: Sat, 27 Feb 2016 19:14:44 +0300 Subject: lsns.c: fix error return If non-negative value returned, errno could be unset (especially 0). Signed-off-by: Karel Zak --- lib/sysfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/sysfs.c') 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); -- cgit v1.2.3-55-g7522