OSDN Git Service

STPK-1429 Don't add trailing zero to sysfs write buffer
authorPatrick Porlan <patrick.porlan@intel.com>
Tue, 27 May 2014 15:01:11 +0000 (17:01 +0200)
committersuyyala <sridhar.uyyala@intel.com>
Sat, 7 Jun 2014 16:36:18 +0000 (09:36 -0700)
The final NUL is not required, so don't write one.

Issue: STPK-1429

Change-Id: I8df959f7f205c818211e938da36a46581bb6e7d9
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
utils.c

diff --git a/utils.c b/utils.c
index 9e4fb27..3a1290d 100644 (file)
--- a/utils.c
+++ b/utils.c
@@ -35,7 +35,7 @@ int sysfs_write_int(const char path[PATH_MAX], int value)
                return -1;
        }
 
-       len = sprintf(buf, "%d", value) + 1;
+       len = sprintf(buf, "%d", value);
 
        ret = write(fd, buf, len);