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:
Richard Frith-MacDonald 2011-02-11 14:31:25 +00:00
parent 51cf9b9cf9
commit 60885954c6
7 changed files with 52 additions and 27 deletions

View file

@ -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)
{