mirror of
https://github.com/nmap/nmap.git
synced 2025-12-10 17:59:04 +00:00
Fix a bug in Windows rename_file.
It was returning before moving the file if the unlink succeeded.
This commit is contained in:
@@ -1029,8 +1029,8 @@ static int rename_file(const char *from_filename, const char *to_filename)
|
|||||||
/* Windows rename doesn't remove the destination if it exists. */
|
/* Windows rename doesn't remove the destination if it exists. */
|
||||||
errno = 0;
|
errno = 0;
|
||||||
rc = unlink(to_filename);
|
rc = unlink(to_filename);
|
||||||
if (rc == 0 || errno == ENOENT)
|
if (rc == -1 && errno != ENOENT)
|
||||||
return 0;
|
return -1;
|
||||||
|
|
||||||
return rename(from_filename, to_filename);
|
return rename(from_filename, to_filename);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user