Commit 475d7593 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Use stat rather than fopen+fclose to check if file exists

parent be0af925
......@@ -33,6 +33,7 @@
#include <stdio.h>
#include <stdlib.h> /* free() */
#include <sys/types.h> /* opendir() */
#include <sys/stat.h>
#include <dirent.h> /* opendir() */
#include <assert.h>
......@@ -730,7 +731,8 @@ int vout_Snapshot( vout_thread_t *p_vout, picture_t *p_pic )
if( var_GetBool( p_vout, "snapshot-sequential" ) == true )
{
int i_num = var_GetInteger( p_vout, "snapshot-num" );
FILE *p_file;
struct stat st;
do
{
free( psz_filename );
......@@ -743,7 +745,8 @@ int vout_Snapshot( vout_thread_t *p_vout, picture_t *p_pic )
return VLC_EGENERIC;
}
}
while( ( p_file = utf8_fopen( psz_filename, "r" ) ) && !fclose( p_file ) );
while( utf8_stat( psz_filename, &st ) == 0 );
var_SetInteger( p_vout, "snapshot-num", i_num );
}
else
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment