summaryrefslogtreecommitdiff
path: root/multimedia/mpeg_encode/patches/patch-ak
blob: 1febc77357cb4003e006e2e92d9ea3f97e75d022 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
$NetBSD: patch-ak,v 1.1 2005/10/05 11:45:46 salo Exp $

Fix for SA17008, from Gentoo.

--- ../convert/vidtojpeg.c.orig	1995-01-20 04:25:40.000000000 +0100
+++ ../convert/vidtojpeg.c	2005-10-05 13:16:27.000000000 +0200
@@ -123,9 +123,9 @@
   XImage *ximage;
   char *tdata;
   char *obase;
-  char ofname[256];
+  char ofname[4096], tempfile[4096];
   int height, width;
-  char command[256];
+  char command[4096];
 
 
   if ((argc != 7) && (argc != 8))usage (argv[0]);
@@ -221,9 +221,11 @@
 
 
     sprintf(ofname, "%s.%d.jpeg", obase, i);
-    outFile = fopen("/tmp/foobar", "w");
+    sprintf(tempfile, "%s.%d.jpeg.tmp", obase, i);
+    outFile = fopen(tempfile, "w");
     if (!outFile) {
       perror("Couldn't open output file.");
+      exit(1);
     }
 
     for (r=0; r<height; r++) {
@@ -239,9 +241,10 @@
 
     free(tdata);
 
-    sprintf(command, "rawtoppm %d %d < /tmp/foobar | cjpeg > %s",
-	    width, height, ofname);
+    sprintf(command, "rawtoppm %d %d < %s | cjpeg > %s",
+	    width, height, tempfile, ofname);
     system(command);
+    unlink(tempfile);
   }
 }