Commit 9ff4e8e7 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

- Fix compiler warning

- Fix directory separator on Windows
- Some cleanup
parent d5caf653
...@@ -466,7 +466,6 @@ gnutls_Addx509Directory( vlc_object_t *p_this, ...@@ -466,7 +466,6 @@ gnutls_Addx509Directory( vlc_object_t *p_this,
vlc_bool_t b_priv ) vlc_bool_t b_priv )
{ {
DIR* dir; DIR* dir;
const char *psz_dirent;
if( *psz_dirname == '\0' ) if( *psz_dirname == '\0' )
psz_dirname = "."; psz_dirname = ".";
...@@ -499,23 +498,20 @@ gnutls_Addx509Directory( vlc_object_t *p_this, ...@@ -499,23 +498,20 @@ gnutls_Addx509Directory( vlc_object_t *p_this,
} }
#endif #endif
while( ( psz_dirent = utf8_readdir( dir ) ) != NULL ) for (;;)
{ {
char *psz_filename; char *ent = utf8_readdir (dir);
int check; if (ent == NULL)
break;
if( (psz_dirent == NULL) if ((strcmp (ent, ".") == 0) || (strcmp (ent, "..") == 0))
|| ( strcmp( ".", psz_dirent ) == 0 )
|| ( strcmp( "..", psz_dirent ) == 0 ) )
continue; continue;
check = asprintf( &psz_filename, "%s/%s", psz_dirname, psz_dirent ); char path[strlen (psz_dirname) + strlen (ent) + 2];
free( psz_dirent ); sprintf (path, "%s"DIR_SEP"%s", psz_dirname, ent);
if( check == -1 ) free (ent);
continue;
gnutls_Addx509File( p_this, cred, psz_filename, b_priv ); gnutls_Addx509File( p_this, cred, path, b_priv );
free( psz_filename );
} }
closedir( dir ); closedir( dir );
......
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