Message ID | 152157867701.19898.6466178424544300544.stgit@dwillia2-desk3.amr.corp.intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
diff --git a/util/sysfs.c b/util/sysfs.c index e067f065a820..0440fd0f49a3 100644 --- a/util/sysfs.c +++ b/util/sysfs.c @@ -39,6 +39,7 @@ int __sysfs_read_attr(struct log_ctx *ctx, const char *path, char *buf) n = read(fd, buf, SYSFS_ATTR_SIZE); close(fd); if (n < 0 || n >= SYSFS_ATTR_SIZE) { + buf[0] = 0; log_dbg(ctx, "failed to read %s: %s\n", path, strerror(errno)); return -errno; }
Terminate the buffer for sysfs_read_attr() users that might not properly handle the error code. Signed-off-by: Dan Williams <dan.j.williams@intel.com> --- util/sysfs.c | 1 + 1 file changed, 1 insertion(+)