Hi all,
Not sure where (or who!) this would be best suited, so I'll post it here... mostly because I'm probably wrong, and don't want to file a bug report until I get some feedback!
In smb_devoptab.c, I don't think setting errno to EOVERFLOW in the first two blocks is correct, and in the third it should only be set if the read size is less than 0.
685 // Don't try to read if the read pointer is past the end of file
686 if (file->offset >= file->len)
687 {
688 r->_errno = EOVERFLOW;
689 _SMB_unlock(file->env);
690 return 0;
691 }
692
693 // Don't read past end of file
694 if (len + file->offset > file->len)
695 {
696 r->_errno = EOVERFLOW;
697 len = file->len - file->offset;
698 }
699
700 // Short circuit cases where len is 0 (or less)
701 if (len <= 0)
702 {
703 r->_errno = EOVERFLOW;
704 _SMB_unlock(file->env);
705 return -1;
706 }
On my Linux box trying to read past the end of the file, or requesting 0 bytes, does not generate an error, nor does it when reading from the SD card using libfat. Subsequently, using ferror() on a file stream yields differing results depending on where the file is being read from.
Edit: Nevermind...Upgrading to the new devkitPPC r18 seems to have fixed the problem.
Edited 1 time(s). Last edit at 10/11/2009 03:39AM by DrTwox.