The Samba-Bugzilla – Bug 10617
lseek not receiving arguments properly
Last modified: 2014-10-13 10:48:04 UTC
I've encountered a very bizarre and unusual bug in libsmbclient. Arguments are not being properly passed into SMBC_lseek_ctx. The bug can be reproduced by running the attached C program.
Expected output from the program:
Return value: 0
Actual output from the program:
Return value: 13
Error: Invalid argument
In addition, when I apply the attached patch, I see the following:
That value changes every time, but I'm expecting it to be 0.
I have seen this happen on Ubuntu, Fedora, Linux Mint, and a copy of libsmbclient that I built from scratch.
Created attachment 9951 [details]
C program to reproduce the bug
Created attachment 9952 [details]
Debug patch to show the whence value
OK, I have some new information about this bug. I've determined that my C program and libsmbclient disagree about the size of off_t. My program thinks it's 4 bytes, and the library thinks it's 8. What could cause this? Is the library redefining off_t somewhere? Or somehow setting it to 64-bit?
Never mind, it seems that I've been tripped up by Large File Support. I did not realize that was not enabled by default in the compiler.