Fix a race condtition in the server startup

Bill Medland billmedland at mercuryspeed.com
Sun Feb 27 09:15:20 CST 2005


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 at codeweavers.com>
>     Fix a race condition in create_dir().

-- 
Bill Medland
mailto:billmedland at mercuryspeed.com
http://webhome.idirect.com/~kbmed




More information about the wine-devel mailing list