Skip to content

Commit 997c2e5

Browse files
committed
Fixed incorrect reliance on errno in emubd
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.
1 parent d88f0ac commit 997c2e5

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

emubd/lfs_emubd.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ int lfs_emubd_erase(const struct lfs_config *cfg, lfs_block_t block) {
196196
}
197197
}
198198

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

0 commit comments

Comments
 (0)