Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset 48178b56 in mainline


Ignore:
Timestamp:
2017-03-07T17:41:37Z (3 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
master
Children:
e796dc8
Parents:
eca9fd0
Message:

Load segment using a long read

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/generic/elf/elf_mod.c

    reca9fd0 r48178b56  
    390390        }
    391391
    392 /*      rc = read(fd, (void *)(entry->p_vaddr + bias), entry->p_filesz);
    393         if (rc < 0) { printf("read error\n"); return EE_INVALID; }*/
    394 
    395         /* Long reads are not possible yet. Load segment piecewise. */
    396 
    397         unsigned left, now;
    398         uint8_t *dp;
    399 
    400         left = entry->p_filesz;
    401         dp = seg_ptr;
    402 
    403         while (left > 0) {
    404                 now = 16384;
    405                 if (now > left) now = left;
    406 
    407                 rc = read(elf->fd, dp, now);
    408 
    409                 if (rc != (ssize_t) now) {
    410                         DPRINTF("Read error.\n");
    411                         return EE_INVALID;
    412                 }
    413 
    414                 left -= now;
    415                 dp += now;
     392        rc = read(elf->fd, seg_ptr, entry->p_filesz);
     393        if (rc < 0) {
     394                DPRINTF("read error\n");
     395                return EE_INVALID;
    416396        }
    417397
Note: See TracChangeset for help on using the changeset viewer.