source: trunk/tools/mkimage/patches/100-portability.patch @ 22344

Last change on this file since 22344 was 22344, checked in by jow, 6 years ago

[tools] mkimage: fix compilation on FreeBSD

File size: 779 bytes
  • tools/kwbimage.c

    a b INVL_DATA: 
    206206        exit (EXIT_FAILURE); 
    207207} 
    208208 
     209#ifndef __GLIBC__ 
     210#ifndef __FreeBSD__ 
     211static ssize_t 
     212getline(char **line, size_t *len, FILE *fd) 
     213{ 
     214        char *tmp; 
     215        int tmplen; 
     216 
     217        tmp = fgetln(fd, &tmplen); 
     218        if (!tmp) 
     219                return -1; 
     220 
     221        if (!*line || tmplen > *len) { 
     222                *len = tmplen + 1; 
     223                *line = realloc(*line, *len); 
     224        } 
     225 
     226        strncpy(*line, tmp, tmplen); 
     227        line[tmplen] = 0; 
     228        return tmplen; 
     229} 
     230#endif 
     231#endif 
     232 
    209233/* 
    210234 * this function sets the kwbimage header by- 
    211235 *      1. Abstracting input command line arguments data 
  • include/image.h

    a b  
    4949 
    5050#endif /* USE_HOSTCC */ 
    5151 
     52#ifndef ulong 
     53#define ulong unsigned long 
     54#endif 
     55 
    5256#include <command.h> 
    5357 
    5458#if defined(CONFIG_FIT) 
Note: See TracBrowser for help on using the repository browser.