Rev 3354 | Rev 3364 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 3354 | Rev 3355 | ||
---|---|---|---|
Line 145... | Line 145... | ||
145 | } else { |
145 | } else { |
146 | i = 0; |
146 | i = 0; |
147 | } |
147 | } |
148 | 148 | ||
149 | while (dirs[i] != NULL) { |
149 | while (dirs[i] != NULL) { |
- | 150 | /* Sometimes make or scripts conjoin odd paths. Account for something |
|
150 | /* Rewind to start of relative path */ |
151 | * like this: ../../foo/bar/../foo/foofoo/./bar */ |
151 | while (!strcmp(dirs[i], "..")) { |
152 | if (!strcmp(dirs[i], "..") || !strcmp(dirs[i], ".")) { |
152 | if (0 != (chdir(dirs[i]))) { |
153 | if (0 != (chdir(dirs[i]))) { |
153 | cli_error(CL_EFAIL, "%s: impossible path: %s", |
154 | cli_error(CL_EFAIL, "%s: impossible path: %s", |
154 | cmdname, path); |
155 | cmdname, path); |
155 | ret ++; |
156 | ret ++; |
156 | goto finit; |
157 | goto finit; |
157 | } |
158 | } |
158 | i++; |
- | |
159 | } |
- | |
160 | getcwd(wdp, PATH_MAX); |
- | |
161 | /* Sometimes make or scripts conjoin odd paths. Account for something |
- | |
162 | * like this: ../../foo/bar/../foo/foofoo/./bar */ |
- | |
163 | if (!strcmp(dirs[i], "..") || !strcmp(dirs[i], ".")) { |
- | |
164 | chdir(dirs[i]); |
- | |
165 | getcwd(wdp, PATH_MAX); |
159 | getcwd(wdp, PATH_MAX); |
166 | } else { |
160 | } else { |
167 | if (-1 == (mkdir(dirs[i], 0))) { |
161 | if (-1 == (mkdir(dirs[i], 0))) { |
168 | cli_error(CL_EFAIL, |
162 | cli_error(CL_EFAIL, |
169 | "%s: failed at %s/%s", wdp, dirs[i]); |
163 | "%s: failed at %s/%s", wdp, dirs[i]); |