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

2014-09-23 Thread Pino Toscano
On Tuesday 23 September 2014 17:20:35 Hu Tao wrote:
 Signed-off-by: Hu Tao hu...@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

___
Libguestfs mailing list
Libguestfs@redhat.com
https://www.redhat.com/mailman/listinfo/libguestfs


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

2014-09-23 Thread Richard W.M. Jones
On Tue, Sep 23, 2014 at 04:00:54PM +0200, Pino Toscano wrote:
 On Tuesday 23 September 2014 17:20:35 Hu Tao wrote:
  Signed-off-by: Hu Tao hu...@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...

Yup, I believe this is the case where we cannot get rid of PATH_MAX :-(

Rich.

  
  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
 
 ___
 Libguestfs mailing list
 Libguestfs@redhat.com
 https://www.redhat.com/mailman/listinfo/libguestfs

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-top is 'top' for virtual machines.  Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.
http://people.redhat.com/~rjones/virt-top

___
Libguestfs mailing list
Libguestfs@redhat.com
https://www.redhat.com/mailman/listinfo/libguestfs