}
if (NT_STATUS_IS_ERR(smbcli_unlink(cli->tree, fname))) {
- /* All until the last unlink will fail with sharing violation. */
- if (!NT_STATUS_EQUAL(smbcli_nt_error(cli->tree),NT_STATUS_SHARING_VIOLATION)) {
+ /* All until the last unlink will fail with sharing violation
+ but also the last request can fail since the file could have
+ been successfully deleted by another (test) process */
+ NTSTATUS status = smbcli_nt_error(cli->tree);
+ if ((!NT_STATUS_EQUAL(status, NT_STATUS_SHARING_VIOLATION))
+ && (!NT_STATUS_EQUAL(status, NT_STATUS_OBJECT_NAME_NOT_FOUND))) {
torture_comment(tctx, "unlink of %s failed (%s)\n", fname, smbcli_errstr(cli->tree));
correct = false;
}