static int is_mounted_freebsd()

in src/mount_davfs.c [888:914]


static int is_mounted_freebsd(void)
{
    static struct statfs *sfsbuf;
    size_t sfsbufsize;
    int mntsize;
    int i;
    int found = 0;

    mntsize = getfsstat(NULL, 0, MNT_NOWAIT);
    if (mntsize > 0) {
        sfsbufsize = (mntsize + 1) * sizeof(struct statfs);
        if ((sfsbuf = malloc(sfsbufsize)) == NULL)
            ERR("malloc");
        mntsize = getfsstat(sfsbuf, (long)sfsbufsize, MNT_NOWAIT);
        for (i = 0; i < mntsize; i++) {
            struct statfs *sfs;
            sfs = &sfsbuf[i];
            if (strcmp(mpoint, sfs->f_mntonname) == 0
                && strcmp(url, sfs->f_mntfromname) == 0) {
                found = 1;
                break;
            }
        }
    }
    free(sfsbuf);
    return found;
}