[prev in list] [next in list] [prev in thread] [next in thread] 

List:       libguestfs
Subject:    Re: [Libguestfs] [PATCH nbdkit 1/4] common: Move get_current_dir_name(3) compatibility function.
From:       Eric Blake <eblake () redhat ! com>
Date:       2018-10-30 13:37:31
Message-ID: f1d5ee50-7261-e380-60f2-d628bb77792f () redhat ! com
[Download RAW message or body]

On 10/28/18 5:13 AM, Richard W.M. Jones wrote:
> So that it can be used in plugins.
> ---
>   common/include/Makefile.am            |  1 +
>   common/include/get-current-dir-name.h | 62 +++++++++++++++++++++++++++
>   src/Makefile.am                       |  4 +-
>   src/utils.c                           | 14 +-----
>   4 files changed, 68 insertions(+), 13 deletions(-)
> 

> +static inline char *
> +get_current_dir_name (void)
> +{
> +  char *ret;
> +
> +  ret = malloc (PATH_MAX);

Doesn't work on GNU Hurd, which intentionally doesn't define PATH_MAX 
(on the grounds that it would be an arbitrary limit), but...

> +++ b/src/utils.c
> @@ -44,20 +44,10 @@
>   #include <termios.h>
>   #include <errno.h>
>   
> +#include "get-current-dir-name.h"
> +
>   #include "internal.h"
>   
> -#ifndef HAVE_GET_CURRENT_DIR_NAME
> -static char *
> -get_current_dir_name (void)
> -{
> -  char *ret = malloc (PATH_MAX);
> -
> -  ret = getcwd (ret, PATH_MAX);

...not really a problem, since no one has ported nbdkit to GNU Hurd in 
the first place.

LGTM


-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org

_______________________________________________
Libguestfs mailing list
Libguestfs@redhat.com
https://www.redhat.com/mailman/listinfo/libguestfs
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic