bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 07/12] ftpfs: fix error handling in refresh_dir


From: Samuel Thibault
Subject: Re: [PATCH 07/12] ftpfs: fix error handling in refresh_dir
Date: Wed, 20 Nov 2013 23:57:48 +0100
User-agent: Mutt/1.5.21+34 (58baf7c9f32f) (2010-12-30)

Justus Winter, le Wed 20 Nov 2013 14:38:00 +0100, a écrit :
> Found using the Clang Static Analyzer.
> 
> * ftpfs/dir.c (refresh_dir): Fix error handling.
> ---
>  ftpfs/dir.c |    9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/ftpfs/dir.c b/ftpfs/dir.c
> index da5ddbe..61c337b 100644
> --- a/ftpfs/dir.c
> +++ b/ftpfs/dir.c
> @@ -381,8 +381,12 @@ refresh_dir (struct ftpfs_dir *dir, int update_stats, 
> time_t timestamp,
>    /* Make sure `.' and `..' are always included (if the actual list also
>       includes `.' and `..', the ordered may be rearranged).  */
>    err = update_ordered_name (".", &dfs);
> -  if (! err)
> -    err = update_ordered_name ("..", &dfs);
> +  if (err)
> +    goto out;
> +
> +  err = update_ordered_name ("..", &dfs);
> +  if (err)
> +    goto out;

Mmm, the usual coding style would rather be to test !err before if
(update_stats)

>    /* Refetch the directory from the server.  */
>    if (update_stats)
> @@ -407,6 +411,7 @@ refresh_dir (struct ftpfs_dir *dir, int update_stats, 
> time_t timestamp,
>        sweep (dir);
>      }
>  
> + out:
>    ftpfs_release_ftp_conn (dir->fs, conn);
>  
>    return err;
> -- 
> 1.7.10.4
> 

-- 
Samuel
<y> la vraie vie, c'est quand le prompt passe de $ à #



reply via email to

[Prev in Thread] Current Thread [Next in Thread]