[FFmpeg-cvslog] r11479 - trunk/tools/trasher.c
melanson
subversion
Wed Jan 9 01:29:50 CET 2008
Author: melanson
Date: Wed Jan 9 01:29:49 2008
New Revision: 11479
Log:
Error checking: make sure that there are 3 parameters and that the
file open operation succeeds.
Modified:
trunk/tools/trasher.c
Modified: trunk/tools/trasher.c
==============================================================================
--- trunk/tools/trasher.c (original)
+++ trunk/tools/trasher.c Wed Jan 9 01:29:49 2008
@@ -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));
More information about the ffmpeg-cvslog
mailing list