changeset 6333:69e14bf9e223

mencoder out-of-diskspace error handling, patch by Eric Lammerts <eric@lammerts.org>
author arpi
date Fri, 07 Jun 2002 22:40:06 +0000
parents ff858ab25b11
children 5becd843ff47
files mencoder.c
diffstat 1 files changed, 8 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mencoder.c	Fri Jun 07 22:39:31 2002 +0000
+++ b/mencoder.c	Fri Jun 07 22:40:06 2002 +0000
@@ -1100,6 +1100,10 @@
  }
 #endif
 
+ if(ferror(muxer_f)) {
+     mp_msg(MSGT_MENCODER,MSGL_FATAL,"%s: error writing file.\n", out_filename);
+     mencoder_exit(1, NULL);
+ }
 
 } // while(!eof)
 
@@ -1124,7 +1128,10 @@
 printf("Fixup AVI header...\n");
 fseek(muxer_f,0,SEEK_SET);
 aviwrite_write_header(muxer,muxer_f); // update header
-fclose(muxer_f);
+if(ferror(muxer_f) || fclose(muxer_f) != 0) {
+    mp_msg(MSGT_MENCODER,MSGL_FATAL,"%s: error writing file.\n", out_filename);
+    mencoder_exit(1, NULL);
+}
 
 if(out_video_codec==VCODEC_FRAMENO && mux_v->timer>100){
     printf("Recommended video bitrate for 650MB CD: %d\n",(int)((650*1024*1024-muxer_f_size)/mux_v->timer/125));