diff options
author | Christopher Haster <chaster@utexas.edu> | 2019-07-29 05:53:13 +0300 |
---|---|---|
committer | Christopher Haster <chaster@utexas.edu> | 2019-07-29 05:53:13 +0300 |
commit | e1f3b90b56c31503473ab19cc1c6b466cc699eff (patch) | |
tree | b3065f1fb5d7ea7f0040191a94ca5ded1a439adb /emubd/lfs_emubd.c | |
parent | 51fabc672b43a6285bced7e6574989cfc203ebd9 (diff) | |
parent | 74fe46de3de98cecdff8681ccd53c481c31352e6 (diff) |
Merge remote-tracking branch 'origin/master' into debug-improvements
Diffstat (limited to 'emubd/lfs_emubd.c')
-rw-r--r-- | emubd/lfs_emubd.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/emubd/lfs_emubd.c b/emubd/lfs_emubd.c index 2f729fb..ee20f27 100644 --- a/emubd/lfs_emubd.c +++ b/emubd/lfs_emubd.c @@ -11,7 +11,6 @@ #include <stdlib.h> #include <stdio.h> #include <limits.h> -#include <dirent.h> #include <sys/stat.h> #include <unistd.h> #include <assert.h> @@ -96,7 +95,7 @@ int lfs_emubd_create(const struct lfs_config *cfg, const char *path) { snprintf(emu->child, LFS_NAME_MAX, ".stats"); FILE *f = fopen(emu->path, "r"); if (!f) { - memset(&emu->stats, 0, sizeof(emu->stats)); + memset(&emu->stats, LFS_EMUBD_ERASE_VALUE, sizeof(emu->stats)); } else { size_t res = fread(&emu->stats, sizeof(emu->stats), 1, f); lfs_emubd_fromle32(emu); @@ -265,7 +264,7 @@ int lfs_emubd_prog(const struct lfs_config *cfg, lfs_block_t block, // update history and stats if (block != emu->history.blocks[0]) { - memcpy(&emu->history.blocks[1], &emu->history.blocks[0], + memmove(&emu->history.blocks[1], &emu->history.blocks[0], sizeof(emu->history) - sizeof(emu->history.blocks[0])); emu->history.blocks[0] = block; } |