[SCM] libav/experimental: Error checking: make sure that there are 3 parameters and that the file open operation succeeds.

siretart at users.alioth.debian.org siretart at users.alioth.debian.org
Sun Jun 30 16:11:36 UTC 2013


The following commit has been merged in the experimental branch:
commit 90527811d7db0da5d770235261c4b718b0869a99
Author: Mike Melanson <mike at multimedia.cx>
Date:   Wed Jan 9 00:29:49 2008 +0000

    Error checking: make sure that there are 3 parameters and that the
    file open operation succeeds.
    
    Originally committed as revision 11479 to svn://svn.ffmpeg.org/ffmpeg/trunk

diff --git a/tools/trasher.c b/tools/trasher.c
index cc9f368..60a2753 100644
--- a/tools/trasher.c
+++ b/tools/trasher.c
@@ -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));
 

-- 
Libav/FFmpeg packaging



More information about the pkg-multimedia-commits mailing list