On 08/29/2014 04:05 PM, Pádraig Brady wrote: > On 08/29/2014 03:46 PM, Fridolin Pokorny wrote: >> On Fri, 2014-08-29 at 16:02 +0200, Fridolin Pokorny wrote: >>> On Wed, 2014-08-27 at 13:06 -0600, Eric Blake wrote: >>>> On 08/27/2014 10:15 AM, Pádraig Brady wrote: >>>>> On 08/27/2014 03:08 PM, Fridolin Pokorny wrote: >>>>>> diff --git a/lib/mountlist.c b/lib/mountlist.c >>>>> >>>>> Cool, this fits well. >>>>> It would be good to mention the functionality and >>>>> performance benefits in the changelog. >>>>> >>>>>> +#ifdef MOUNTED_PROC_MOUNTINFO >>>>>> +static const char * >>>>>> +mountinfo_path (void) { >>>>>> + static char filename[sizeof ("/proc//mountinfo") + 13]; /* 13 to hold >>>>>> a PID */ >>>> >>>> The magic number 13 is gross, compared to using <intprops.h> from gnulib >>>> and using INT_STRLEN_BOUND(pid_t) (which should evaluate to 13) instead. >>> >>> The magic 13 is from the kernel, I didn't know about >>> INT_STRLEN_BOUND(), thanks for suggestion. It is far better solution. >>> >>> Anyway, it might be better to use /proc/self instead of /proc/<PID> as >>> suggested. Modified patch attached (also ChangeLog was modified). >> >> Fixed typos, sorry for that. >> s/enviroment/environment/ >> s/determinated/determined/ > > Looking good. I'll probably add in the m4: > > if test -f /proc/self/mountinfo; then > AC_MSG_WARN([This system supports /proc/self/mountinfo but libmount is > missing.]) > fi
I added the above. Also I added a guard around the mnt_inter_new() call, and a corresponding mnt_iter_free() call to avoid leaks. Now pushed at: http://git.sv.gnu.org/gitweb/?p=gnulib.git;a=commitdiff;h=3ea43e0 thanks, Pádraig.