Spritetm / libesphttpd

NOTE: THIS CODE IS UNMAINTAINED. Please take a look at https://github.com/chmorgan/libesphttpd instead.
125 stars 109 forks source link

mkupgimg not working on windows #16

Closed valkuc closed 8 years ago

valkuc commented 8 years ago

Hi! In mkupgimg.c need to add O_BINARY option in openFile methdod. Otherwise on windows mkupgimg utility returns "build/app.user1.bin: No error" error and exit. Here is fixed function:

int openFile(char *file) {
    int r=open(file, O_BINARY | O_RDONLY);
    if (r<=0) {
        perror(file);
        exit(1);
    }
    return r;
}
valkuc commented 8 years ago

Thats not all. Also in main() need to add binary option to output file: of=open(argv[4], O_WRONLY|O_CREAT|O_TRUNC|O_BINARY, 0666);

Spritetm commented 8 years ago

Fixed in c1d3c14e6e56ca6c860485324feafa866648d2ea . Sorry, I keep forgetting about Windows users whenever I write open() statements. Thanks for reporting!