changeset 436:5e210bace0f1

added "File not found" clause
author thomask
date Sat, 16 Apr 2005 11:24:56 +0000
parents ec6d35cccfb5
children 1b4034b27e93
files dstress.c
diffstat 1 files changed, 10 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/dstress.c	Sat Apr 16 08:18:57 2005 +0000
+++ b/dstress.c	Sat Apr 16 11:24:56 2005 +0000
@@ -82,12 +82,18 @@
 			if(fileInfo.st_size>0){
 				*(back+fileInfo.st_size+1) = '\x00';
 			}else{
-				back = "\x00";
+				back = NULL;
 			}
 		}
 		close(file);
 	}
-	return back;
+
+	if(back){
+		return back;
+	}
+
+	fprintf(stderr, "File not found \"%s\"\n", filename);
+	exit(EXIT_FAILURE);
 }
 
 void *xmalloc(size_t size)
@@ -639,7 +645,7 @@
 		fprintf(stderr, "--------\n");
 	}else{
 		printf("@bug@ %d (%s)\n", modus, arg[2]);
-		return -1;
+		return EXIT_FAILURE;
 	}
-	return 0;
+	return EXIT_SUCCESS;
 }