Skip to content

Commit

Permalink
Fixed incorrect reliance on errno in emubd
Browse files Browse the repository at this point in the history
When running the tests, the emubd erase function relied on the value of
errno to not change over a possible call to unlink. Annoyingly, I've
only seen this cause problems on a couple of specific Travis instances
while self-hosting littlefs on top of littlefs-fuse.
  • Loading branch information
geky committed Jan 23, 2018
1 parent d88f0ac commit 997c2e5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion emubd/lfs_emubd.c
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ int lfs_emubd_erase(const struct lfs_config *cfg, lfs_block_t block) {
}
}

if (errno == ENOENT || (S_ISREG(st.st_mode) && (S_IWUSR & st.st_mode))) {
if (err || (S_ISREG(st.st_mode) && (S_IWUSR & st.st_mode))) {
FILE *f = fopen(emu->path, "w");
if (!f) {
return -errno;
Expand Down

0 comments on commit 997c2e5

Please sign in to comment.