[pacman-dev] [PATCH 5/5] diskspace: log errors when opening the mount table fails

Dan McGee dpmcgee at gmail.com
Thu Jun 14 17:31:06 EDT 2012


On Wed, Jun 13, 2012 at 1:00 PM, Dave Reisner <dreisner at archlinux.org> wrote:
> Signed-off-by: Dave Reisner <dreisner at archlinux.org>
> ---
>  lib/libalpm/diskspace.c |    6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/lib/libalpm/diskspace.c b/lib/libalpm/diskspace.c
> index 1fc297e..df2bb71 100644
> --- a/lib/libalpm/diskspace.c
> +++ b/lib/libalpm/diskspace.c
> @@ -82,6 +82,8 @@ static alpm_list_t *mount_point_list(alpm_handle_t *handle)
>        fp = setmntent(MOUNTED, "r");
>
>        if(fp == NULL) {
> +               _alpm_log(handle, ALPM_LOG_ERROR, "failed to open file: %s: %s\n",
> +                               MOUNTED, strerror(errno));
>                return NULL;
>        }
>
> @@ -118,6 +120,8 @@ static alpm_list_t *mount_point_list(alpm_handle_t *handle)
>        fp = fopen("/etc/mnttab", "r");
>
>        if(fp == NULL) {
> +               _alpm_log(handle, ALPM_LOG_ERROR, "failed to open file: /etc/mnttab: %s\n",
If you use an %s substitution you don't have to introduce another
translatable string. Because you do know these should be all wrapped
in _() calls, of course.

> +                               strerror(errno));
>                return NULL;
>        }
>
> @@ -153,6 +157,8 @@ static alpm_list_t *mount_point_list(alpm_handle_t *handle)
>        entries = getmntinfo(&fsp, MNT_NOWAIT);
>
>        if(entries < 0) {
> +               _alpm_log(handle, ALPM_LOG_ERROR,
> +                               "failed to open mount table for reading: %s\n", strerror(errno));
>                return NULL;
>        }
>
> --
> 1.7.10.4
>
>


More information about the pacman-dev mailing list