lib/safe_macros.c: fix safe_write() and safe_pwrite()

The len_strict is ineffective in byte length verification
because of the improper if-condition.

Signed-off-by: Guangwen Feng <fenggw-fnst@cn.fujitsu.com>
Reviewed-by: Jan Stancek <jstancek@redhat.com>
diff --git a/lib/safe_macros.c b/lib/safe_macros.c
index a3d997c..173d72f 100644
--- a/lib/safe_macros.c
+++ b/lib/safe_macros.c
@@ -414,7 +414,7 @@
 	ssize_t rval;
 
 	rval = write(fildes, buf, nbyte);
-	if ((len_strict == 0 && rval == -1) || (size_t)rval != nbyte) {
+	if (rval == -1 || (len_strict && (size_t)rval != nbyte)) {
 		tst_brkm(TBROK | TERRNO, cleanup_fn,
 			 "%s:%d: write(%d,%p,%zu) failed",
 		         file, lineno, fildes, buf, rval);
@@ -430,7 +430,7 @@
 	ssize_t rval;
 
 	rval = pwrite(fildes, buf, nbyte, offset);
-	if ((len_strict == 0 && rval == -1) || (size_t)rval != nbyte) {
+	if (rval == -1 || (len_strict && (size_t)rval != nbyte)) {
 		tst_brkm(TBROK | TERRNO, cleanup_fn,
 			 "%s:%d: pwrite(%d,%p,%zu,%ld) failed",
 			 file, lineno, fildes, buf, rval, offset);