1 diff -Nur autofs-4.1.3.orig/daemon/automount.c autofs-4.1.3/daemon/automount.c
2 --- autofs-4.1.3.orig/daemon/automount.c 2004-04-05 21:14:10.000000000 +0800
3 +++ autofs-4.1.3/daemon/automount.c 2004-06-05 21:13:28.000000000 +0800
6 if (stat(buf, &st) == 0 && !S_ISDIR(st.st_mode))
11 + /* last component, return -1 */
18 @@ -1088,9 +1091,11 @@
19 close(ap.state_pipe[0]);
20 close(ap.state_pipe[1]);
23 err = ap.lookup->lookup_mount(ap.path,
29 * If at first you don't succeed, hide all
30 @@ -1163,8 +1168,11 @@
35 ret = ap.lookup->lookup_mount(ap.path,
36 name, namelen, ap.lookup->context);
40 error("failed to recover from partial expiry of %s\n",
42 diff -Nur autofs-4.1.3.orig/modules/mount_bind.c autofs-4.1.3/modules/mount_bind.c
43 --- autofs-4.1.3.orig/modules/mount_bind.c 2004-05-10 20:44:30.000000000 +0800
44 +++ autofs-4.1.3/modules/mount_bind.c 2004-06-05 18:12:38.000000000 +0800
50 + int status, existed = 1;
52 debug(MODPREFIX "calling mkdir_path %s", fullpath);
54 - if ((status = mkdir_path(fullpath, 0555)) && errno != EEXIST) {
55 + status = mkdir_path(fullpath, 0555);
56 + if (status && errno != EEXIST) {
57 error(MODPREFIX "mkdir_path %s failed: %m", fullpath);
64 if (is_mounted(fullpath)) {
65 warn("BUG: %s already mounted", fullpath);
71 - if (!ap.ghost && name_len)
72 + if ((!ap.ghost && name_len) || !existed)
76 diff -Nur autofs-4.1.3.orig/modules/mount_changer.c autofs-4.1.3/modules/mount_changer.c
77 --- autofs-4.1.3.orig/modules/mount_changer.c 2004-05-10 20:44:30.000000000 +0800
78 +++ autofs-4.1.3/modules/mount_changer.c 2004-06-05 18:18:04.000000000 +0800
84 + int status, existed = 1;
90 debug(MODPREFIX "calling mkdir_path %s", fullpath);
92 - if ((status = mkdir_path(fullpath, 0555)) && errno != EEXIST) {
93 + status = mkdir_path(fullpath, 0555);
94 + if (status && errno != EEXIST) {
95 error(MODPREFIX "mkdir_path %s failed: %m", fullpath);
102 debug(MODPREFIX "Swapping CD to slot %s", name);
104 err = swapCD(what, name);
109 - if (!ap.ghost && name_len)
110 + if ((!ap.ghost && name_len) || !existed)
113 error(MODPREFIX "failed to mount %s (type %s) on %s",
114 diff -Nur autofs-4.1.3.orig/modules/mount_ext2.c autofs-4.1.3/modules/mount_ext2.c
115 --- autofs-4.1.3.orig/modules/mount_ext2.c 2004-05-10 20:44:30.000000000 +0800
116 +++ autofs-4.1.3/modules/mount_ext2.c 2004-06-05 18:23:09.000000000 +0800
122 int mount_mount(const char *root, const char *name, int name_len,
123 const char *what, const char *fstype, const char *options, void *context)
128 const char *fsck_prog;
130 + int status, existed = 1;
132 fullpath = alloca(strlen(root) + name_len + 2);
136 debug(MODPREFIX "calling mkdir_path %s", fullpath);
138 - if ((status = mkdir_path(fullpath, 0555)) && errno != EEXIST) {
139 + status = mkdir_path(fullpath, 0555);
140 + if (status && errno != EEXIST) {
141 error(MODPREFIX "mkdir_path %s failed: %m", fullpath);
148 if (is_mounted(fullpath)) {
149 error("BUG: %s already mounted", fullpath);
155 - if (!ap.ghost && name_len)
156 + if ((!ap.ghost && name_len) || !existed)
158 error(MODPREFIX "failed to mount %s (type %s) on %s",
159 what, fstype, fullpath);
160 diff -Nur autofs-4.1.3.orig/modules/mount_generic.c autofs-4.1.3/modules/mount_generic.c
161 --- autofs-4.1.3.orig/modules/mount_generic.c 2004-05-10 20:44:30.000000000 +0800
162 +++ autofs-4.1.3/modules/mount_generic.c 2004-06-05 18:22:10.000000000 +0800
168 + int status, existed = 1;
170 fullpath = alloca(strlen(root) + name_len + 2);
174 debug(MODPREFIX "calling mkdir_path %s", fullpath);
176 - if ((status = mkdir_path(fullpath, 0555)) && errno != EEXIST) {
177 + status = mkdir_path(fullpath, 0555);
178 + if (status && errno != EEXIST) {
179 error(MODPREFIX "mkdir_path %s failed: %m", fullpath);
186 if (is_mounted(fullpath)) {
187 error("BUG: %s already mounted", fullpath);
193 - if (!ap.ghost && name_len)
194 + if ((!ap.ghost && name_len) || !existed)
197 error(MODPREFIX "failed to mount %s (type %s) on %s",
198 diff -Nur autofs-4.1.3.orig/modules/mount_nfs.c autofs-4.1.3/modules/mount_nfs.c
199 --- autofs-4.1.3.orig/modules/mount_nfs.c 2004-06-05 14:24:58.000000000 +0800
200 +++ autofs-4.1.3/modules/mount_nfs.c 2004-06-05 21:10:17.000000000 +0800
201 @@ -445,14 +445,19 @@
202 whatstr, "bind", NULL, mount_bind->context);
204 /* Not a local host - do an NFS mount */
206 + int status, existed = 1;
208 debug(MODPREFIX "calling mkdir_path %s", fullpath);
209 - if ((status = mkdir_path(fullpath, 0555)) && errno != EEXIST) {
211 + status = mkdir_path(fullpath, 0555);
212 + if (status && errno != EEXIST) {
213 error(MODPREFIX "mkdir_path %s failed: %m", fullpath);
220 if (is_mounted(fullpath)) {
221 error("BUG: %s already mounted", fullpath);
227 - if (!ap.ghost && name_len)
228 + if ((!ap.ghost && name_len) || !existed)
231 error(MODPREFIX "nfs: mount failure %s on %s",