test: stat.c - only errors when they occour

glen glen at pld-linux.org
Sat Mar 3 13:04:49 CET 2007


Author: glen                         Date: Sat Mar  3 12:04:49 2007 GMT
Module: test                          Tag: HEAD
---- Log message:
- only errors when they occour

---- Files affected:
test:
   stat.c (1.1 -> 1.2) 

---- Diffs:

================================================================
Index: test/stat.c
diff -u test/stat.c:1.1 test/stat.c:1.2
--- test/stat.c:1.1	Sat Mar  3 13:03:15 2007
+++ test/stat.c	Sat Mar  3 13:04:44 2007
@@ -2,9 +2,13 @@
 #include <unistd.h>
 
 int main() {
-const char *filename = ".";
-struct stat stat_buf;
+	const char *filename = ".";
+	struct stat stat_buf;
 
-__xstat(3, filename, &stat_buf); perror("xstat");
-stat(filename, &stat_buf);perror("stat");
+	if (-1 == __xstat(3, filename, &stat_buf)) {
+		perror("xstat");
+	}
+	if (-1 == stat(filename, &stat_buf)) {
+		perror("stat");
+	}
 }
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/test/stat.c?r1=1.1&r2=1.2&f=u



More information about the pld-cvs-commit mailing list