Re: [Libguestfs] [PATCH 09/13] syntax-check: fix prohibit_path_max_allocation check

Pino Toscano
2014-09-23T14:00:54Z

On Tuesday 23 September 2014 17:20:35 Hu Tao wrote:
> Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
> ---
>  daemon/inotify.c | 12 +++++++++++-
>  1 file changed, 11 insertions(+), 1 deletion(-)

While I'd personally get rid of PATH_MAX at all, I understand the Linux
inotify implementation relies on it...

>
> diff --git a/daemon/inotify.c b/daemon/inotify.c
> index 36e5ede..b847b7d 100644
> --- a/daemon/inotify.c
> +++ b/daemon/inotify.c
> @@ -309,7 +309,7 @@ do_inotify_files (void)
>    unsigned int i;
>    FILE *fp = NULL;
>    guestfs_int_inotify_event_list *events;
> -  char buf[PATH_MAX];
> +  char *buf = NULL;

Make it CLEANUP_FREE, so you don't need to manually free it later (and
gets freed in every exit point of the function).

--
Pino Toscano