changeset 35310:7077d1aed027

Abort when opening the file failed instead of calling "write" with an invalid descriptor.
author reimar
date Sat, 10 Nov 2012 14:16:33 +0000
parents c93f7ddd73df
children 18eebabbc172
files libaf/af_export.c
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libaf/af_export.c	Sat Nov 10 13:55:01 2012 +0000
+++ b/libaf/af_export.c	Sat Nov 10 14:16:33 2012 +0000
@@ -104,9 +104,11 @@
     // 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));