On Fri, Apr 19, 2019 at 2:30 AM Hans Leidekker hans@codeweavers.com wrote:
On Wed, 2019-04-17 at 08:29 -0600, Erich E. Hoover wrote:
...
- TRACE("Deleting symlink %s\n", unix_name.Buffer);
- if (unlink( unix_name.Buffer ) < 0)
- {
status = FILE_GetNtStatus();
goto cleanup;
- }
- if (mkdir( unix_name.Buffer, 0775 ) < 0)
- {
status = FILE_GetNtStatus();
goto cleanup;
- }
Shouldn't this also be a single operation?
Indeed it should, I could have sworn that I updated that a long time ago - probably lost it in a rebase at some point.
What about ownership and permissions on the directory? Should they be preserved?
Yes, though I don't see a great way to do that with permissions (ownership is fine). At least on Linux symlinks don't preserve permission data, so about the best that can be done is to copy the permissions of the symlink's destination (if available). Unless you are aware of some way to do this that I'm not? I explored this a long time ago and I still have a little tidbit of test code from that: === int ret = fchmodat(-1, "testlink", 0775, AT_SYMLINK_NOFOLLOW); fprintf(stderr, "ret? %d %m\n", ret); === and it (unfortunately) returns: ret? -1 Operation not supported
Thank you so much for taking a look at these patches for me, hopefully it won't be too much longer before they're ready for upstreaming :)
Best, Erich