Changeset 705 for soft


Ignore:
Timestamp:
Aug 24, 2015, 5:08:30 PM (9 years ago)
Author:
guerin
Message:

kernel: fix error handling in _load_writable_segments()

_fat_read() and _fat_lseek() return positive values on success.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • soft/giet_vm/giet_kernel/ctx_handler.c

    r702 r705  
    127127
    128128    // load Elf-Header into buffer from .elf file
    129     if ( _fat_lseek( fd, 0, SEEK_SET ) ) return 1;
    130     if ( _fat_read( fd, buf, 4096 ) ) return 1;
     129    if ( _fat_lseek( fd, 0, SEEK_SET ) < 0 ) return 1;
     130    if ( _fat_read( fd, buf, 4096 ) < 0 ) return 1;
    131131
    132132#if GIET_DEBUG_SWITCH
     
    141141    unsigned int nsegments      = elf_header_ptr->e_phnum;
    142142
    143     // load Program-Header-Table from .elf file 
    144     if ( _fat_lseek( fd, offset, SEEK_SET ) ) return 1;
    145     if ( _fat_read( fd, buf, 4096 ) ) return 1;
     143    // load Program-Header-Table from .elf file
     144    if ( _fat_lseek( fd, offset, SEEK_SET ) < 0 ) return 1;
     145    if ( _fat_read( fd, buf, 4096 ) < 0 ) return 1;
    146146
    147147#if GIET_DEBUG_SWITCH
     
    167167
    168168            // load the segment
    169             if ( _fat_lseek( fd, seg_offset, SEEK_SET ) ) return 1;
    170             if ( _fat_read( fd, (void*)seg_vaddr, seg_size ) ) return 1;
     169            if ( _fat_lseek( fd, seg_offset, SEEK_SET ) < 0 ) return 1;
     170            if ( _fat_read( fd, (void*)seg_vaddr, seg_size ) < 0 ) return 1;
    171171
    172172#if GIET_DEBUG_SWITCH
Note: See TracChangeset for help on using the changeset viewer.