Commit 10e3d966 authored by Francois Gouget's avatar Francois Gouget Committed by Alexandre Julliard

Fix a race condition in create_dir().

parent 0502638e
...@@ -509,7 +509,7 @@ static void create_dir( const char *name, struct stat *st ) ...@@ -509,7 +509,7 @@ static void create_dir( const char *name, struct stat *st )
if (lstat( name, st ) == -1) if (lstat( name, st ) == -1)
{ {
if (errno != ENOENT) fatal_perror( "lstat %s", name ); if (errno != ENOENT) fatal_perror( "lstat %s", name );
if (mkdir( name, 0700 ) == -1) fatal_perror( "mkdir %s", name ); if (mkdir( name, 0700 ) == -1 && errno != EEXIST) fatal_perror( "mkdir %s", name );
if (lstat( name, st ) == -1) fatal_perror( "lstat %s", name ); if (lstat( name, st ) == -1) fatal_perror( "lstat %s", name );
} }
if (!S_ISDIR(st->st_mode)) fatal_error( "%s is not a directory\n", name ); if (!S_ISDIR(st->st_mode)) fatal_error( "%s is not a directory\n", name );
......
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