if((rc->stat_file = fopen(param->filename, "w+b")) == NULL)
if((rc->stat_file = qfopen(param->filename, "w+b")) == NULL)
 int rc_2pass1_create(xvid_plg_create_t * create, rc_2pass1_t ** handle){    xvid_plugin_2pass1_t * param = (xvid_plugin_2pass1_t *)create->param;	rc_2pass1_t * rc;    /* check filename */    if ((param->filename == NULL) ||		(param->filename != NULL && param->filename[0] == '\0'))        return XVID_ERR_FAIL;    /* allocate context struct */	if((rc = (rc_2pass1_t *)malloc(sizeof(rc_2pass1_t))) == NULL)		return(XVID_ERR_MEMORY);    /* Initialize safe defaults for 2pass 1 */    rc->stat_file = NULL;	/* Open the 1st pass file */	if((rc->stat_file = fopen(param->filename, "w+b")) == NULL)		return(XVID_ERR_FAIL);	/* I swear xvidcore isn't buggy, but when using mencoder+xvid4 i observe	 * this weird bug.	 *	 * Symptoms: The stats file grows until it's fclosed, but at this moment	 *           a large part of the file is filled by 0x00 bytes w/o any	 *           reasonable cause. The stats file is then completly unusable	 *	 * So far, i think i found "the why":	 *  - take a MPEG stream containing 2 sequences (concatenate 2 MPEG files	 *    together)	 *  - Encode this MPEG file	 *	 * It should trigger the bug	 *	 * I think this is caused by some kind of race condition on mencoder module	 * start/stop.	 *  - mencoder encodes the first sequence	 *    + xvid4 module opens xvid-twopass.stats and writes stats in it.	 *  - mencoder detects the second sequence and initialize a second	 *    module and stops the old encoder	 *    + new xvid4 module opens a new xvid-twopass.stats, old xvid4	 *      module closes it	 *	 * This is IT, got a racing condition.	 * Unbuffered IO, may help ... */	setbuf(rc->stat_file, NULL);	/*	 * The File Header	 */	fprintf(rc->stat_file, "# XviD 2pass stat file (core version %d.%d.%d)\n",			XVID_VERSION_MAJOR(XVID_VERSION),			XVID_VERSION_MINOR(XVID_VERSION),			XVID_VERSION_PATCH(XVID_VERSION));	fprintf(rc->stat_file, "# Please do not modify this file\n\n");    rc->fq_error = 0;    *handle = rc;	return(0);}