diff options
author | Damien George <damien.p.george@gmail.com> | 2013-12-29 10:30:14 -0800 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2013-12-29 10:30:14 -0800 |
commit | 319b28a35596ba1333610385146ec408d34e22a0 (patch) | |
tree | 6e893b235ae50fc99a0ca815435f833e281def36 | |
parent | 5ebbfe7e5119147ed1f49edb9d0d0dda42f68d71 (diff) | |
parent | 729fd12fbf003d4eb61a8429e06889ea66688939 (diff) | |
download | micropython-319b28a35596ba1333610385146ec408d34e22a0.tar.gz micropython-319b28a35596ba1333610385146ec408d34e22a0.zip |
Merge pull request #3 from pfalcon/for-upstream
Trivial fixes for building unix version
-rw-r--r-- | py/lexerunix.c | 7 | ||||
-rw-r--r-- | unix/Makefile | 2 |
2 files changed, 7 insertions, 2 deletions
diff --git a/py/lexerunix.c b/py/lexerunix.c index ac07781b5a..80daf6009a 100644 --- a/py/lexerunix.c +++ b/py/lexerunix.c @@ -48,8 +48,13 @@ mp_lexer_t *mp_lexer_new_from_file(const char *filename) { uint size = lseek(fd, 0, SEEK_END); lseek(fd, 0, SEEK_SET); char *data = m_new(char, size); - read(fd, data, size); + int read_size = read(fd, data, size); close(fd); + if (read_size != size) { + printf("error reading file %s\n", filename); + m_free(data); + return NULL; + } return mp_lexer_new_from_str_len(filename, data, size, true); } diff --git a/unix/Makefile b/unix/Makefile index 441804e509..91e26e5247 100644 --- a/unix/Makefile +++ b/unix/Makefile @@ -65,7 +65,7 @@ $(PROG): $(BUILD) $(OBJ) size $(PROG) $(BUILD): - mkdir $@ + mkdir -p $@ $(BUILD)/%.o: %.c $(CC) $(CFLAGS) -c -o $@ $< |