On Wed, 2019-04-17 at 08:29 -0600, Erich E. Hoover wrote:
Thank you in advance to those who look these patches over, your feedback is greatly appreciated.
+NTSTATUS FILE_RemoveSymlink(HANDLE handle, REPARSE_GUID_DATA_BUFFER *buffer) +{
- int dest_fd, needs_close;
- ANSI_STRING unix_name;
- NTSTATUS status;
- if ((status = server_get_unix_fd( handle, FILE_SPECIAL_ACCESS, &dest_fd, &needs_close, NULL, NULL )))
return status;
- if ((status = server_get_unix_name( handle, &unix_name )))
goto cleanup;
- 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? What about ownership and permissions on the directory? Should they be preserved?