[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 $ à #
- Re: [PATCH 02/12] utils: fix dead initialization, (continued)
- [PATCH 05/12] fatfs: fix error handling in diskfs_lookup_hard, Justus Winter, 2013/11/20
- [PATCH 04/12] libnetfs: fix a dead store, Justus Winter, 2013/11/20
- [PATCH 03/12] libps: fix the length computation in fprint_frac_value, Justus Winter, 2013/11/20
- [PATCH 06/12] fatfs: fix error handling in diskfs_get_directs, Justus Winter, 2013/11/20
- [PATCH 07/12] ftpfs: fix error handling in refresh_dir, Justus Winter, 2013/11/20
- Re: [PATCH 07/12] ftpfs: fix error handling in refresh_dir,
Samuel Thibault <=
- [PATCH 12/12] libshouldbeinlibc: fix error handling in maptime_map, Justus Winter, 2013/11/20
- [PATCH 09/12] usermux: actually use the computed flags value in netfs_attempt_utimes, Justus Winter, 2013/11/20
- [PATCH 08/12] nfsd: fix error handling in op_remove, Justus Winter, 2013/11/20
- [PATCH 10/12] libshouldbeinlibc: fix dead initialization in fmt_named_interval, Justus Winter, 2013/11/20
- [PATCH 11/12] mach-defpager: drop all register qualifiers, Justus Winter, 2013/11/20