Commit 06d4c94e authored by melanson's avatar melanson

Error checking: make sure that there are 3 parameters and that the

file open operation succeeds.


git-svn-id: file:///var/local/repositories/ffmpeg/trunk@11479 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent 239bfc8e
......@@ -6,10 +6,21 @@
int main(int argc, char** argv)
{
FILE *f= fopen(argv[1], "rb+");
int count= atoi(argv[2]);
int maxburst= atoi(argv[3]);
int length;
FILE *f;
int count, maxburst, length;
if (argc < 4){
printf("USAGE: trasher <filename> <count> <maxburst>\n");
return 1;
}
f= fopen(argv[1], "rb+");
if (!f){
perror(argv[1]);
return 2;
}
count= atoi(argv[2]);
maxburst= atoi(argv[3]);
srand (time (0));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment