apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeff Trawick <traw...@attglobal.net>
Subject Re: [PATCH] WIN32 filedup
Date Fri, 04 Apr 2003 12:04:26 GMT
Mladen Turk wrote:
> Hi,
> 
> The WIN32 version of apr_file_dup is missing the create_mutex call.
> This make duplicated file unusable (the ap segfaults) if opened
> with APR_APPEND flag.
> 
> Here is the patch:
> 
> RCS file: /home/cvspublic/apr/file_io/win32/filedup.c,v
> retrieving revision 1.54
> diff -u -3 -r1.54 filedup.c
> --- filedup.c	7 Jan 2003 00:52:53 -0000	1.54
> +++ filedup.c	31 Mar 2003 15:50:27 -0000
> @@ -81,7 +81,9 @@
>      (*new_file)->fname = apr_pstrdup(p, old_file->fname);
>      (*new_file)->append = old_file->append;
>      (*new_file)->buffered = FALSE;
> -
> +    if ((*new_file)->append)
> +        apr_thread_mutex_create(&(*new_file)->mutex, 
> +                                APR_THREAD_MUTEX_DEFAULT, p); 

Shouldn't we check retcode of apr_thread_mutex_create() and return a 
failure if it fails?

Two out of three calls surveyed in win32/file_io/*c recommend checking 
the return code.


Mime
View raw message