libdsm icon indicating copy to clipboard operation
libdsm copied to clipboard

OSX smb_fopen with "/" at the beginning of the file path

Open shaybc opened this issue 9 years ago • 5 comments
trafficstars

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.

shaybc avatar Apr 30 '16 23:04 shaybc

But the file is named test.txt?

jbkempf avatar May 08 '16 20:05 jbkempf

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);

shaybc avatar May 18 '16 20:05 shaybc

well / would be the root of the server, so I'm not surprised. Not sure if it is a bug, though

jbkempf avatar May 19 '16 13:05 jbkempf

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.

shaybc avatar May 20 '16 18:05 shaybc

Fair enough.

jbkempf avatar May 27 '16 16:05 jbkempf