--- jhead-2.7/jhead.c.bak 2007-01-12 04:54:53.000000000 +0200 +++ jhead-2.7/jhead.c 2007-11-13 15:28:46.024053106 +0200 @@ -148,9 +148,10 @@ static int FileEditComment(char * TempFi fprintf(stderr, "Can't create file '%s'\n",TempFileName); ErrFatal("could not create temporary file"); } - fwrite(Comment, CommentSize, 1, file); - - fclose(file); + if ((fwrite(Comment, CommentSize, 1, file) != 1) || fclose(file)) { + fprintf(stderr, "Can't write file '%s'\n",TempFileName); + ErrFatal("could not write temporary file"); + } fflush(stdout); // So logs are contiguous. @@ -966,8 +967,9 @@ void ProcessFile(const char * FileName) CommentFile = fopen(OutFileName,"w"); if (CommentFile){ - fwrite((char *)CommentSec->Data+2, CommentSec->Size-2 ,1, CommentFile); - fclose(CommentFile); + if ((fwrite((char *)CommentSec->Data+2, CommentSec->Size-2 ,1, CommentFile) != 1) || fclose(CommentFile)) { + ErrFatal("Could not write comment file"); + } }else{ ErrFatal("Could not write comment file"); }