[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: mountlist: libmount support on Linux
From: |
Fridolin Pokorny |
Subject: |
Re: mountlist: libmount support on Linux |
Date: |
Fri, 29 Aug 2014 16:02:39 +0200 |
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).
Have a nice day!
Fridolin Pokorny
0001-mountlist-added-proc-self-mountinfo-support.patch
Description: Text Data