~ubuntu-branches/ubuntu/raring/autofs5/raring

« back to all changes in this revision

Viewing changes to modules/mount_ext2.c

  • Committer: Bazaar Package Importer
  • Author(s): Jan Christoph Nordholz
  • Date: 2009-03-09 01:16:48 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20090309011648-gjynlid883f0s2c4
Tags: 5.0.4-1
* New upstream version (5.0.4 plus patchset as of 2009/03/09).
  * Closes: #518728.
  * Remove dpatch 14, applied upstream.
* New dpatch 14 to avoid using the relatively young SOCK_CLOEXEC
  feature.
* Only invoke 'make clean' on clean target so ./configure isn't
  purged.
* Fix a typo in the postinst regarding the ucf conffile handling.
* Add 'set -e' to package maintenance scripts.
* Drop unnecessary /var/run/autofs from package.

Show diffs side-by-side

added added

removed removed

Lines of Context:
43
43
        const char *p, *p1;
44
44
        int err, ro = 0;
45
45
        const char *fsck_prog;
46
 
        int rlen, status, existed = 1;
 
46
        int len, status, existed = 1;
 
47
 
 
48
        if (ap->flags & MOUNT_FLAG_REMOUNT)
 
49
                return 0;
47
50
 
48
51
        /* Root offset of multi-mount */
49
 
        if (*name == '/' && name_len == 1) {
50
 
                rlen = strlen(root);
51
 
                name_len = 0;
 
52
        len = strlen(root);
 
53
        if (root[len - 1] == '/') {
 
54
                fullpath = alloca(len);
 
55
                len = snprintf(fullpath, len, "%s", root);
52
56
        /* Direct mount name is absolute path so don't use root */
53
 
        } else if (*name == '/')
54
 
                rlen = 0;
55
 
        else
56
 
                rlen = strlen(root);
57
 
 
58
 
        fullpath = alloca(rlen + name_len + 2);
59
 
        if (!fullpath) {
60
 
                char *estr = strerror_r(errno, buf, MAX_ERR_BUF);
61
 
                logerr(MODPREFIX "alloca: %s", estr);
62
 
                return 1;
 
57
        } else if (*name == '/') {
 
58
                fullpath = alloca(len + 1);
 
59
                len = sprintf(fullpath, "%s", root);
 
60
        } else {
 
61
                fullpath = alloca(len + name_len + 2);
 
62
                len = sprintf(fullpath, "%s/%s", root, name);
63
63
        }
64
 
 
65
 
        if (name_len) {
66
 
                if (rlen)
67
 
                        sprintf(fullpath, "%s/%s", root, name);
68
 
                else
69
 
                        sprintf(fullpath, "%s", name);
70
 
        } else
71
 
                sprintf(fullpath, "%s", root);
 
64
        fullpath[len] = '\0';
72
65
 
73
66
        debug(ap->logopt, MODPREFIX "calling mkdir_path %s", fullpath);
74
67
 
83
76
        if (!status)
84
77
                existed = 0;
85
78
 
86
 
        if (is_mounted(_PATH_MOUNTED, fullpath, MNTS_REAL)) {
87
 
                error(ap->logopt,
88
 
                      MODPREFIX "warning: %s is already mounted", fullpath);
89
 
                return 0;
90
 
        }
91
 
 
92
79
        if (options && options[0]) {
93
80
                for (p = options; (p1 = strchr(p, ',')); p = p1)
94
81
                        if (!strncmp(p, "ro", p1 - p) && ++p1 - p == sizeof("ro"))
148
135
                if (ap->type != LKP_INDIRECT)
149
136
                        return 1;
150
137
 
151
 
                if ((!ap->ghost && name_len) || !existed)
 
138
                if ((!(ap->flags & MOUNT_FLAG_GHOST) && name_len) || !existed)
152
139
                        rmdir_path(ap, fullpath, ap->dev);
153
140
 
154
141
                return 1;