Changeset 12992


Ignore:
Timestamp:
Oct 10, 2009, 2:45:10 PM (10 years ago)
Author:
gz
Message:

Changes for images larger than 2GB (r12811)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/working-0711/ccl/lisp-kernel/image.c

    r12198 r12992  
    2626#endif
    2727#include <stdio.h>
     28#include <limits.h>
    2829
    2930
     
    175176  off_t
    176177    pos = seek_to_next_page(fd), advance;
    177   int
     178  natural
    178179    mem_size = sect->memory_size;
    179180  void *addr;
     
    379380writebuf(int fd, char *bytes, natural n)
    380381{
    381   natural remain = n;
    382   int result;
     382  natural remain = n, this_size;
     383  signed_natural result;
    383384
    384385  while (remain) {
    385     result = write(fd, bytes, remain);
     386    this_size = remain;
     387    if (this_size > INT_MAX) {
     388      this_size = INT_MAX;
     389    }
     390    result = write(fd, bytes, this_size);
    386391    if (result < 0) {
    387392      return errno;
    388393    }
    389394    bytes += result;
     395
    390396    remain -= result;
    391397  }
Note: See TracChangeset for help on using the changeset viewer.