[prev in list] [next in list] [prev in thread] [next in thread] 

List:       wine-devel
Subject:    Re: Fix a race condtition in the server startup
From:       Bill Medland <billmedland () mercuryspeed ! com>
Date:       2005-02-27 15:15:20
Message-ID: 200502270715.20963.billmedland () mercuryspeed ! com
[Download RAW message or body]

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().

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


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic