~ubuntu-branches/ubuntu/lucid/libpam-mount/lucid

« back to all changes in this revision

Viewing changes to src/mount-sysv.c

  • Committer: Bazaar Package Importer
  • Author(s): Steve Langasek
  • Date: 2009-08-13 13:01:03 UTC
  • mfrom: (32.1.7 sid)
  • Revision ID: james.westby@ubuntu.com-20090813130103-wnn1h2t2ny0d1gp0
Tags: 1.27-2ubuntu1
* Merge from Debian unstable, remaining changes:
  - Implement https://wiki.ubuntu.com/PAMConfigFrameworkSpec by adding
    debian/pam-auth-update and installing that.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 *      Copyright © Jan Engelhardt, 2007 - 2009
 
3
 *
 
4
 *      This file is part of pam_mount; you can redistribute it and/or
 
5
 *      modify it under the terms of the GNU Lesser General Public License
 
6
 *      as published by the Free Software Foundation; either version 2.1
 
7
 *      of the License, or (at your option) any later version.
 
8
 */
 
9
#include "config.h"
 
10
#ifdef HAVE_GETMNTENT
 
11
#include <errno.h>
 
12
#include <stdbool.h>
 
13
#include <stdio.h>
 
14
#include <string.h>
 
15
#include "pam_mount.h"
 
16
 
 
17
int pmt_already_mounted(const struct config *const config,
 
18
    const struct vol *vpt, struct HXbtree *vinfo)
 
19
{
 
20
        int (*xcmp)(const char *, const char *);
 
21
        hxmc_t *dev;
 
22
        int cret, sret;
 
23
 
 
24
        if ((dev = pmt_vol_to_dev(vpt)) == NULL) {
 
25
                l0g("pmt::vol_to_dev: %s\n", strerror(errno));
 
26
                return -1;
 
27
        }
 
28
 
 
29
        xcmp = fstype2_icase(vpt->type) ? strcasecmp : strcmp;
 
30
 
 
31
        cret = pmt_cmtab_mounted(dev, vpt->mountpoint);
 
32
        sret = pmt_smtab_mounted(dev, vpt->mountpoint, xcmp);
 
33
        if (cret > 0 || sret > 0)
 
34
                return true;
 
35
        if (cret == 0 && sret == 0)
 
36
                return false;
 
37
        if (sret < 0)
 
38
                return sret;
 
39
        if (cret < 0)
 
40
                return cret;
 
41
        return false;
 
42
}
 
43
#endif /* HAVE_GETMNTENT */