xffm fstab changes

Benedikt Meurer Benedikt.Meurer at unix-ag.uni-siegen.de
Mon Apr 7 10:57:52 CEST 2003


On Sun, 06, Apr 2003, edscott wilson garcia wrote:

> Benny,

Edscott,

>   I've readded the macros that check for getmntinfo(). FreeBSD won't
> work because the open_fstab() falls into the "Solaris" section (it
> defines HAVE_GETVFSENT) but fails miserably with:
> fstab.c: In function `open_fstab':
> fstab.c:356: storage size of `vbuf' isn't known
> fstab.c:357: storage size of `mbuf' isn't known
> fstab.c:368: too many arguments to function `getvfsent'
> fstab.c:398: too many arguments to function `getvfsent'
> But the getmntinfo() works like a charm. I've also added a working
> is_mounted() function that works in both FreeBSD and Linux. With this
> function it is no longer necessary to flag the fstab entry as mounted or
> not (which is bugged, because another process can mount/unmount and
> render the flag useless). The is_mounted() function has 3 return values:
> 0 = not mounted 
> 1 = mounted
> -1 = can't tell (when this is returned, the "mounted" flag will be used)

Please don't use getmntinfo() if statfs() does the job. Please use
statfs() in is_mounted as shown in my example code.

> It's also an exported function, because both the main menu and the popup
> menu now display either a "mount" or "unmount" item for each fstab
> entry. 

Nice.

> Also, I've changed instances where you wrote "sizeof(text)" with text as
> a character pointer (it causes bugs later down the road, so I avoid it).
> I always prefer strlen(text), but in this case I directly put in the
> array length.

I use sizeof() to determine the length of arrays (not pointers), since its
easier to read I think. But using the array length directly is ok :-).

One word about the autoconf stuff: I'm trying to get rid of most of the
unneccessary m4 macros in order to make the stuff maintainable. Therefore
I removed the references to the jm_* macros in the configure.ac (except for
the gnu strftime() stuff which is going to be fixed soon). You put that in
place again. Why?

> Edscott

regards,
Benedikt

-- 
Those who do not understand Unix are condemned to reinvent it, poorly.
    -- Henry Spencer



More information about the Xfce4-dev mailing list