On Tue, Jun 16, 2009 at 11:53:43AM +0530, Bharata B Rao wrote:
> On Mon, Jun 15, 2009 at 08:51:52PM +0530, Dhaval Giani wrote:
> > This set of APIs will allow the caller to query the mount table
> > and find out what controller is mounted at what path.
> > 
> > Index: libcg/include/libcgroup.h
> > ===================================================================
> > --- libcg.orig/include/libcgroup.h  2009-06-15 16:21:55.000000000 +0530
> > +++ libcg/include/libcgroup.h       2009-06-15 16:51:42.000000000 +0530
> > @@ -303,6 +303,30 @@
> >   */
> >  int cgroup_get_task_next(void **handle, pid_t *pid);
> >  int cgroup_get_task_end(void **handle);
> > +
> > +/**
> > + * Read the mount table to give a list where each controller is
> > + * mounted
> > + * @handle: Handle to be used for iteration.
> > + * @name: The variable where the name is stored. Should be freed by caller.
> > + * @path: Te variable where the path to the controller is stored. Should be
> > + * freed by the caller.
> > + *
> > + * name and path will be allocated by the API. The caller *must* free
> > + * name and path before calling into the API again else there will be
> > + * leaks.
> 
> As I observed during your previous post of this patch, I am not convinced
> that we should ask user to free @name and @path. Doing it in an iterator
> based API looks ugly to me. I would prefer having the user pass on the
> allocated (to the size of FILENAME_MAX) @name and @path arguments.
> 

How would you suggest to resolve buffer overflows. Either we add in
another argument for the length, or we allocate it statically. (I don't
think expecting the user to allocate (correct amount of) memory and pass
it in is a good idea.)

thanks,
-- 
regards,
Dhaval

------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing 
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
Libcg-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/libcg-devel

Reply via email to