[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: svn commit: r1149675 - in /subversion/trunk/subversion: libsvn_repos/hooks.c libsvn_subr/io.c

From: Lieven Govaerts <svnlgo_at_mobsol.be>
Date: Fri, 22 Jul 2011 20:50:07 +0200

On Fri, Jul 22, 2011 at 8:06 PM, <danielsh_at_apache.org> wrote:
> Author: danielsh
> Date: Fri Jul 22 18:06:12 2011
> New Revision: 1149675
>
> URL: http://svn.apache.org/viewvc?rev=1149675&view=rev
> Log:
> Add error checking.  This manifested as a segfault and a file descriptor leak
> in svnsync of an ra_serf source to an ra_local target.
>

Just to be clear on the wording here: this change does not solve the
file descriptor leak, but does solve the segfault resulting from a
file descriptor leak, currently still in the code. Right?

Tested the fix with success on Mac OS X.

Lieven

> * subversion/libsvn_subr/io.c
>  (svn_io_start_cmd2): Check the return value of apr_procattr_io_set().
>
> * subversion/libsvn_repos/hooks.c
>  (run_hook_cmd): Do not try to use CMD_PROC when it may not have been initialized.
>
> Modified:
>    subversion/trunk/subversion/libsvn_repos/hooks.c
>    subversion/trunk/subversion/libsvn_subr/io.c
>
> Modified: subversion/trunk/subversion/libsvn_repos/hooks.c
> URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_repos/hooks.c?rev=1149675&r1=1149674&r2=1149675&view=diff
> ==============================================================================
> --- subversion/trunk/subversion/libsvn_repos/hooks.c (original)
> +++ subversion/trunk/subversion/libsvn_repos/hooks.c Fri Jul 22 18:06:12 2011
> @@ -202,7 +202,8 @@ run_hook_cmd(svn_string_t **result,
>
>   if (err)
>     {
> -      err = svn_error_createf
> +      /* CMD_PROC is not safe to use. Bail. */
> +      return svn_error_createf
>         (SVN_ERR_REPOS_HOOK_FAILURE, err, _("Failed to start '%s' hook"), cmd);
>     }
>   else
>
> Modified: subversion/trunk/subversion/libsvn_subr/io.c
> URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/io.c?rev=1149675&r1=1149674&r2=1149675&view=diff
> ==============================================================================
> --- subversion/trunk/subversion/libsvn_subr/io.c (original)
> +++ subversion/trunk/subversion/libsvn_subr/io.c Fri Jul 22 18:06:12 2011
> @@ -2489,10 +2489,17 @@ svn_io_start_cmd2(apr_proc_t *cmd_proc,
>
>   /* Forward request for pipes to APR. */
>   if (infile_pipe || outfile_pipe || errfile_pipe)
> -    apr_procattr_io_set(cmdproc_attr,
> -                        infile_pipe ? APR_FULL_BLOCK : APR_NO_PIPE,
> -                        outfile_pipe ? APR_FULL_BLOCK : APR_NO_PIPE,
> -                        errfile_pipe ? APR_FULL_BLOCK : APR_NO_PIPE);
> +    {
> +      apr_err = apr_procattr_io_set(cmdproc_attr,
> +                                    infile_pipe ? APR_FULL_BLOCK : APR_NO_PIPE,
> +                                    outfile_pipe ? APR_FULL_BLOCK : APR_NO_PIPE,
> +                                    errfile_pipe ? APR_FULL_BLOCK : APR_NO_PIPE);
> +
> +      if (apr_err)
> +        return svn_error_wrap_apr(apr_err,
> +                                  _("Can't set process '%s' stdio pipes"),
> +                                  cmd);
> +    }
>
>   /* Have the child print any problems executing its program to errfile. */
>   apr_err = apr_pool_userdata_set(errfile, ERRFILE_KEY, NULL, pool);
>
>
>
Received on 2011-07-22 20:51:01 CEST

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.