comparison libaf/af_export.c @ 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 a93891202051
children 4eedc654175d
comparison
equal deleted inserted replaced
35309:c93f7ddd73df 35310:7077d1aed027
102 s->buf[i] = (uint8_t *)s->buf[0] + i*s->sz*af->data->bps; 102 s->buf[i] = (uint8_t *)s->buf[0] + i*s->sz*af->data->bps;
103 103
104 // Init memory mapping 104 // Init memory mapping
105 s->fd = open(s->filename, O_RDWR | O_CREAT | O_TRUNC, 0640); 105 s->fd = open(s->filename, O_RDWR | O_CREAT | O_TRUNC, 0640);
106 mp_msg(MSGT_AFILTER, MSGL_INFO, "[export] Exporting to file: %s\n", s->filename); 106 mp_msg(MSGT_AFILTER, MSGL_INFO, "[export] Exporting to file: %s\n", s->filename);
107 if(s->fd < 0) 107 if(s->fd < 0) {
108 mp_msg(MSGT_AFILTER, MSGL_FATAL, "[export] Could not open/create file: %s\n", 108 mp_msg(MSGT_AFILTER, MSGL_FATAL, "[export] Could not open/create file: %s\n",
109 s->filename); 109 s->filename);
110 return AF_ERROR;
111 }
110 112
111 // header + buffer 113 // header + buffer
112 mapsize = (SIZE_HEADER + (af->data->bps * s->sz * af->data->nch)); 114 mapsize = (SIZE_HEADER + (af->data->bps * s->sz * af->data->nch));
113 115
114 // grow file to needed size 116 // grow file to needed size