Mercurial > projects > dstress
changeset 440:dc186d1266ba
fixed handling of empty files
author | thomask |
---|---|
date | Mon, 18 Apr 2005 06:13:44 +0000 |
parents | edb0923c9159 |
children | 368156152168 |
files | dstress.c |
diffstat | 1 files changed, 4 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/dstress.c Sun Apr 17 10:03:34 2005 +0000 +++ b/dstress.c Mon Apr 18 06:13:44 2005 +0000 @@ -79,7 +79,7 @@ if(0==fstat(file, &fileInfo)){ back=malloc(fileInfo.st_size+1); fileInfo.st_size = read(file, back, fileInfo.st_size); - if(fileInfo.st_size>0){ + if(fileInfo.st_size>=0){ *(back+fileInfo.st_size+1) = '\x00'; }else{ back = NULL; @@ -91,6 +91,9 @@ if(back){ return back; } + if(0==strcmp(filename, TLOG)){ + return calloc(1,sizeof(char)); + } fprintf(stderr, "File not found \"%s\"\n", filename); exit(EXIT_FAILURE);