mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-31 00:30:53 +00:00
Recommit tested changes.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@32075 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
51cf9b9cf9
commit
60885954c6
7 changed files with 52 additions and 27 deletions
|
@ -3006,6 +3006,7 @@ getBytes(void* dst, void* src, unsigned len, unsigned limit, unsigned *pos)
|
|||
*/
|
||||
- (id) initWithContentsOfMappedFile: (NSString*)path
|
||||
{
|
||||
off_t off;
|
||||
int fd;
|
||||
|
||||
#if defined(__MINGW__)
|
||||
|
@ -3033,14 +3034,15 @@ getBytes(void* dst, void* src, unsigned len, unsigned limit, unsigned *pos)
|
|||
return nil;
|
||||
}
|
||||
/* Find size of file to be mapped. */
|
||||
length = lseek(fd, 0, SEEK_END);
|
||||
if (length < 0)
|
||||
off = lseek(fd, 0, SEEK_END);
|
||||
if (off < 0)
|
||||
{
|
||||
NSWarnMLog(@"unable to seek to eof %@ - %@", path, [NSError _last]);
|
||||
close(fd);
|
||||
DESTROY(self);
|
||||
return nil;
|
||||
}
|
||||
length = off;
|
||||
/* Position at start of file. */
|
||||
if (lseek(fd, 0, SEEK_SET) != 0)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue