]> git.pld-linux.org Git - packages/autofs.git/blame - autofs-4.1.3-bad_chdir.patch
- automount doesn't have -TERM parameter
[packages/autofs.git] / autofs-4.1.3-bad_chdir.patch
CommitLineData
e3a22658 1diff -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
4@@ -99,8 +99,11 @@
5
6 if (stat(buf, &st) == 0 && !S_ISDIR(st.st_mode))
7 errno = ENOTDIR;
8- else
9- continue;
10+ else {
11+ /* last component, return -1 */
12+ if (*cp != '\0')
13+ continue;
14+ }
15 }
16 return -1;
17 }
18@@ -1088,9 +1091,11 @@
19 close(ap.state_pipe[0]);
20 close(ap.state_pipe[1]);
21
22+ chdir(ap.path);
23 err = ap.lookup->lookup_mount(ap.path,
24 pkt->name, pkt->len,
25 ap.lookup->context);
26+ chdir("/");
27
28 /*
29 * If at first you don't succeed, hide all
30@@ -1163,8 +1168,11 @@
31 it.
32 */
33
34+ chdir(ap.path);
35 ret = ap.lookup->lookup_mount(ap.path,
36 name, namelen, ap.lookup->context);
37+ chdir("/");
38+
39 if (ret)
40 error("failed to recover from partial expiry of %s\n",
41 buf);
42diff -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
45@@ -107,15 +107,19 @@
46 fullpath[i] = '\0';
47
48 if (bind_works) {
49- int status;
50+ int status, existed = 1;
51
52 debug(MODPREFIX "calling mkdir_path %s", fullpath);
53
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);
58 return 1;
59 }
60
61+ if (!status)
62+ existed = 0;
63+
64 if (is_mounted(fullpath)) {
65 warn("BUG: %s already mounted", fullpath);
66 return 0;
67@@ -130,7 +134,7 @@
68 unlink(AUTOFS_LOCK);
69
70 if (err) {
71- if (!ap.ghost && name_len)
72+ if ((!ap.ghost && name_len) || !existed)
73 rmdir_path(name);
74 return 1;
75 } else {
76diff -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
79@@ -52,7 +52,7 @@
80 {
81 char *fullpath;
82 int err;
83- int status;
84+ int status, existed = 1;
85
86 fstype = "iso9660";
87
88@@ -80,11 +80,15 @@
89
90 debug(MODPREFIX "calling mkdir_path %s", fullpath);
91
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);
96 return 1;
97 }
98
99+ if (!status)
100+ existed = 0;
101+
102 debug(MODPREFIX "Swapping CD to slot %s", name);
103
104 err = swapCD(what, name);
105@@ -111,7 +115,7 @@
106 unlink(AUTOFS_LOCK);
107
108 if (err) {
109- if (!ap.ghost && name_len)
110+ if ((!ap.ghost && name_len) || !existed)
111 rmdir_path(name);
112
113 error(MODPREFIX "failed to mount %s (type %s) on %s",
114diff -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
117@@ -40,7 +40,6 @@
118 return 0;
119 }
120
121-
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)
124 {
125@@ -48,7 +47,7 @@
126 const char *p, *p1;
127 int err, ro = 0;
128 const char *fsck_prog;
129- int status;
130+ int status, existed = 1;
131
132 fullpath = alloca(strlen(root) + name_len + 2);
133 if (!fullpath) {
134@@ -63,11 +62,15 @@
135
136 debug(MODPREFIX "calling mkdir_path %s", fullpath);
137
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);
142 return 1;
143 }
144
145+ if (!status)
146+ existed = 0;
147+
148 if (is_mounted(fullpath)) {
149 error("BUG: %s already mounted", fullpath);
150 return 0;
151@@ -120,7 +123,7 @@
152 unlink(AUTOFS_LOCK);
153
154 if (err) {
155- if (!ap.ghost && name_len)
156+ if ((!ap.ghost && name_len) || !existed)
157 rmdir_path(name);
158 error(MODPREFIX "failed to mount %s (type %s) on %s",
159 what, fstype, fullpath);
160diff -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
163@@ -46,7 +46,7 @@
164 {
165 char *fullpath;
166 int err;
167- int status;
168+ int status, existed = 1;
169
170 fullpath = alloca(strlen(root) + name_len + 2);
171 if (!fullpath) {
172@@ -61,11 +61,15 @@
173
174 debug(MODPREFIX "calling mkdir_path %s", fullpath);
175
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);
180 return 1;
181 }
182
183+ if (!status)
184+ existed = 0;
185+
186 if (is_mounted(fullpath)) {
187 error("BUG: %s already mounted", fullpath);
188 return 0;
189@@ -89,7 +93,7 @@
190 unlink(AUTOFS_LOCK);
191
192 if (err) {
193- if (!ap.ghost && name_len)
194+ if ((!ap.ghost && name_len) || !existed)
195 rmdir_path(name);
196
197 error(MODPREFIX "failed to mount %s (type %s) on %s",
198diff -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);
203 } else {
204 /* Not a local host - do an NFS mount */
205- int status;
206+ int status, existed = 1;
207
208 debug(MODPREFIX "calling mkdir_path %s", fullpath);
209- if ((status = mkdir_path(fullpath, 0555)) && errno != EEXIST) {
210+
211+ status = mkdir_path(fullpath, 0555);
212+ if (status && errno != EEXIST) {
213 error(MODPREFIX "mkdir_path %s failed: %m", fullpath);
214 return 1;
215 }
216
217+ if (!status)
218+ existed = 0;
219+
220 if (is_mounted(fullpath)) {
221 error("BUG: %s already mounted", fullpath);
222 return 0;
223@@ -477,8 +482,9 @@
224 unlink(AUTOFS_LOCK);
225
226 if (err) {
227- if (!ap.ghost && name_len)
228+ if ((!ap.ghost && name_len) || !existed)
229 rmdir_path(name);
230+
231 error(MODPREFIX "nfs: mount failure %s on %s",
232 whatstr, fullpath);
233 return 1;
This page took 0.711875 seconds and 4 git commands to generate.