… | |
… | |
201 | /* we could even stat and see if it exists */ |
201 | /* we could even stat and see if it exists */ |
202 | static int |
202 | static int |
203 | symlink (const char *old, const char *neu) |
203 | symlink (const char *old, const char *neu) |
204 | { |
204 | { |
205 | #if WINVER >= 0x0600 |
205 | #if WINVER >= 0x0600 |
|
|
206 | int flags; |
|
|
207 | |
|
|
208 | /* This tries out all combinations of SYMBOLIC_LINK_FLAG_DIRECTORY |
|
|
209 | * and SYMBOLIC_LINK_FLAG_ALLOW_UNPRIVILEGED_CREATE, |
|
|
210 | * with directory first. |
|
|
211 | */ |
|
|
212 | for (flags = 3; flags >= 0; --flags) |
206 | if (CreateSymbolicLink (neu, old, 1)) |
213 | if (CreateSymbolicLink (neu, old, flags)) |
207 | return 0; |
214 | return 0; |
208 | |
|
|
209 | if (CreateSymbolicLink (neu, old, 0)) |
|
|
210 | return 0; |
|
|
211 | #endif |
215 | #endif |
212 | |
216 | |
213 | return EIO_ERRNO (ENOENT, -1); |
217 | return EIO_ERRNO (ENOENT, -1); |
214 | } |
218 | } |
215 | |
219 | |