8000 Merge pull request #3 from pfalcon/for-upstream · micropython/micropython@319b28a · GitHub
[go: up one dir, main page]

Skip to content

Commit 319b28a

Browse files
committed
Merge pull request #3 from pfalcon/for-upstream
Trivial fixes for building unix version
2 parents 5ebbfe7 + 729fd12 commit 319b28a

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

py/lexerunix.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,13 @@ mp_lexer_t *mp_lexer_new_from_file(const char *filename) {
4848
uint size = lseek(fd, 0, SEEK_END);
4949
lseek(fd, 0, SEEK_SET);
5050
char *data = m_new(char, size);
51-
read(fd, data, size);
51+
int read_size = read(fd, data, size);
5252
close(fd);
53+
if (read_size != size) {
54+
printf("error reading file %s\n", filename);
55+
m_free(data);
56+
return NULL;
57+
}
5358

5459
return mp_lexer_new_from_str_len(filename, data, size, true);
5560
}

unix/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ $(PROG): $(BUILD) $(OBJ)
6565
size $(PROG)
6666

6767
$(BUILD):
68-
mkdir $@
68+
mkdir -p $@
6969

7070
$(BUILD)/%.o: %.c
7171
$(CC) $(CFLAGS) -c -o $@ $<

0 commit comments

Comments
 (0)
0