[MPlayer-cvslog] r35404 - trunk/libaf/af_export.c

reimar subversion at mplayerhq.hu
Sat Nov 10 15:16:34 CET 2012


Author: reimar
Date: Sat Nov 10 15:16:33 2012
New Revision: 35404

Log:
Abort when opening the file failed instead of calling
"write" with an invalid descriptor.

Modified:
   trunk/libaf/af_export.c

Modified: trunk/libaf/af_export.c
==============================================================================
--- trunk/libaf/af_export.c	Sat Nov 10 14:55:01 2012	(r35403)
+++ trunk/libaf/af_export.c	Sat Nov 10 15:16:33 2012	(r35404)
@@ -104,9 +104,11 @@ static int control(struct af_instance_s*
     // Init memory mapping
     s->fd = open(s->filename, O_RDWR | O_CREAT | O_TRUNC, 0640);
     mp_msg(MSGT_AFILTER, MSGL_INFO, "[export] Exporting to file: %s\n", s->filename);
-    if(s->fd < 0)
+    if(s->fd < 0) {
       mp_msg(MSGT_AFILTER, MSGL_FATAL, "[export] Could not open/create file: %s\n",
 	     s->filename);
+      return AF_ERROR;
+    }
 
     // header + buffer
     mapsize = (SIZE_HEADER + (af->data->bps * s->sz * af->data->nch));


More information about the MPlayer-cvslog mailing list