From 3ed4046fadce3efdc53c26e623b3ee6697e3dcdc Mon Sep 17 00:00:00 2001
From: Michael Niedermayer <michaelni@gmx.at>
Date: Wed, 23 Mar 2005 19:19:59 +0000
Subject: [PATCH] create temporary file in current directory if it failed in
 /tmp

Originally committed as revision 4075 to svn://svn.ffmpeg.org/ffmpeg/trunk
---
 libavcodec/xvidff.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/libavcodec/xvidff.c b/libavcodec/xvidff.c
index 70f744f5e8f..b46b5e3093b 100644
--- a/libavcodec/xvidff.c
+++ b/libavcodec/xvidff.c
@@ -234,6 +234,10 @@ int ff_xvid_encode_init(AVCodecContext *avctx)  {
         }
         strcpy(x->twopassfile, "/tmp/xvidff.XXXXXX");
         fd = mkstemp(x->twopassfile);
+        if(fd < 0){
+            strcpy(x->twopassfile, "./xvidff.XXXXXX");
+            fd = mkstemp(x->twopassfile);
+        }
         if( fd == -1 ) {
             av_log(avctx, AV_LOG_ERROR,
                 "XviD: Cannot write 2-pass pipe\n");
-- 
GitLab