Question some code in server/request.c

Robert Shearman rob at codeweavers.com
Tue Mar 6 07:34:45 CST 2007


Paul Vriens wrote:
> Hi,
>
> while going through the Coverity reports I found CID-293 that mentions
> a possible NULL-RETURN. Marcus sent in a patch that wasn't applied.
>
> If I look at the code (starting at line 537):
>
> /* create the server directory and chdir to it */
> static void create_server_dir( const char *dir )
> {
>    char *p, *server_dir;
>    struct stat st, st2;
>
>    if (!(server_dir = strdup( dir ))) fatal_error( "out of memory\n" );
>
>    /* first create the base directory if needed */
>
>    p = strrchr( server_dir, '/' );
>    *p = 0;
>    create_dir( server_dir, &st );
>
>    /* now create the server directory */
>
>    *p = '/';
>    create_dir( server_dir, &st );
>
>    if (chdir( server_dir ) == -1) fatal_perror( "chdir %s", server_dir );
>    if (stat( ".", &st2 ) == -1) fatal_perror( "stat %s", server_dir );
>    if (st.st_dev != st2.st_dev || st.st_ino != st2.st_ino)
>        fatal_error( "chdir did not end up in %s\n", server_dir );
>
>    free( server_dir );
> }
>
> it looks to me that 'p' is not used at all (this is so since June
> 2002). Am I completely missing something?

p is an alias of server_dir.


-- 
Rob Shearman




More information about the wine-devel mailing list