libsmack: remove redundant strlen() call from accesses_apply()
authorJarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Sun, 1 Dec 2013 15:01:42 +0000 (17:01 +0200)
committerJarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Mon, 2 Dec 2013 07:04:39 +0000 (09:04 +0200)
Return value of snprintf() should give the same length as strlen()
would given that string fits into buffer.

Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
libsmack/libsmack.c

index f7ce313..2d68089 100644 (file)
@@ -720,7 +720,7 @@ static int accesses_apply(struct smack_accesses *handle, int clear)
                        goto err_out;
                }
 
-               ret = write(fd, buf, strlen(buf));
+               ret = write(fd, buf, ret);
                if (ret < 0) {
                        ret = -1;
                        goto err_out;