libdsm
libdsm copied to clipboard
OSX smb_fopen with "/" at the beginning of the file path
hello,
if i call the smb_fopen method with file path of this form: "/test.txt" in read mode on OS X share, i receive a -2 error code (Failed to open file: /test.txt)
failed code sample: const chat * fileNameAndPath = "/test.txt"; int openFileResult = smb_fopen(smbSession, shareID, fileNameAndPath, SMB_MOD_RO, &fileDescriptor);
but if i remove the first "/" and call it like this:
success code sample: const chat * fileNameAndPath = "test.txt"; int openFileResult = smb_fopen(smbSession, shareID, fileNameAndPath, SMB_MOD_RO, &fileDescriptor);
if i try this on a windows share it will work both ways!
my end code simply strip the first "/" from all calls (since OS X and Windows can handle it),
i would love it if the bug was found and fixed (or that someone will prove me wrong),
Thanks, Shay.BC.
But the file is named test.txt?
yes, the file name is test.txt ofcource if i have a longer path it will behave the same, for instance: /folder1/folder2/test.txt will work only if i will set it to: folder1/folder2/test.txt
so the working code is:
const chat * fileNameAndPath = "folder1/folder2/test.txt";
int openFileResult = smb_fopen(smbSession, shareID, fileNameAndPath, SMB_MOD_RO, &fileDescriptor);
well / would be the root of the server, so I'm not surprised. Not sure if it is a bug, though
but you need to be able to set path to the root and relate to folder and files from there, this is a bug, every implementation using your (wonderful) lib - removes the leading "/", i don't think this is the way it should be,
but at least its not a unsolvable bug.
Fair enough.