On February 26, 2005 03:43 pm, Francois Gouget wrote:
There is a race condition in the server startup code which arises if two
I propose the following fix:
if (lstat( name, st ) == -1) { if (errno != ENOENT) fatal_perror( "lstat %s", name ); if (mkdir( name, 0700 ) == -1 && errno != EEXIST) fatal_perror(
"mkdir %s", name );
Using the existing directory is ok because we then check its ownership, permissions, etc. (which we have to do anyway in case it already existed).
How about simply mkdir and if the error is already existed then fine.?
Unchecked, but something like: if (mkdir (name, 0700) == -1) { if (errno != EEXIST) fatal_perror ("Ensuring directory %s", name) }
Changelog:
server/request.c
Francois Gouget fgouget@codeweavers.com Fix a race condition in create_dir().