I have a function that i'm running on my windows against case sensitive remote server (SMB). The function creates two files: "fileA", "FILEa". When i'm trying to unlink the file "fileA" both of my files disappear from the folder. Right after that i'm calling for unlink file "FILEa",and get error that the file does not exist.
My code:
void my_function(Path path)
{
Path filename1 = path;
filename1 + "_fileA";
Path filename2 = path;
filename2 +"_FILEa";
close(open(filename1, O_CREAT | O_EXCL, S_IREAD | S_IWRITE));
try
{
close(open(filename2, O_CREAT | O_EXCL, S_IREAD | S_IWRITE));
}
catch (Exception e)
{
unlink(filename1);
return;
}
unlink(filename1);
unlink(filename2);
}
On wireshark , after Client's unlink , the Client send SMB Find request to query the content of the folder and the server return FILEa in the list. wireshark capture
It seems that windows has internal caching that handles Opens and fileA and FILEa are mapped to the same entry.
Edit:
View of my folder after creating the two files:
I'm using Windows and the code is in cpp. Somebody knows why is this happening to me? Or if there is other function beside unlink that could remove only the chosen file and not both of them? Thank you.