[FFmpeg-cvslog] r11459 - trunk/tools/trasher.c
Mike Melanson
mike
Wed Jan 9 00:51:16 CET 2008
Michael Niedermayer wrote:
>> Also, this segfaults when called without arguments or when the file to
>> open does not exist.
>
> debug it and fix it
> no i dont really care, its not a tool for the user, and any devel can
> read the half page of C to figure it out
Here's a fix. Apply?
--
-Mike Melanson
Index: tools/trasher.c
===================================================================
--- tools/trasher.c (revision 11478)
+++ tools/trasher.c (working copy)
@@ -6,11 +6,24 @@
int main(int argc, char** argv)
{
- FILE *f= fopen(argv[1], "rb+");
- int count= atoi(argv[2]);
- int maxburst= atoi(argv[3]);
+ FILE *f;
+ int count;
+ int maxburst;
int 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));
fseek(f, 0, SEEK_END);
More information about the ffmpeg-cvslog
mailing list