[hackers] [PATCH 6/8] touch: Remove useless variable

From: Michael Forney <mforney_AT_mforney.org>
Date: Fri, 8 Jul 2016 10:24:12 -0700

The only possible return values of stat are 0 or -1, so it doesn't make sense to
store the return value in a variable to make sure it is not positive.
---
 touch.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/touch.c b/touch.c
index 74bdc27..0e8c413 100644
--- a/touch.c
+++ b/touch.c
_AT_@ -21,14 +21,13 @@ touch(const char *file)
 {
 	int fd;
 	struct stat st;
-	int r;
 
-	if ((r = stat(file, &st)) < 0) {
+	if (stat(file, &st) < 0) {
 		if (errno != ENOENT)
 			eprintf("stat %s:", file);
 		if (cflag)
 			return;
-	} else if (!r) {
+	} else {
 		if (!aflag)
 			times[0] = st.st_atim;
 		if (!mflag)
-- 
2.6.2
Received on Fri Jul 08 2016 - 19:24:12 CEST

This archive was generated by hypermail 2.3.0 : Fri Jul 08 2016 - 19:36:34 CEST