enable posix flash (#1894)

This commit is contained in:
Buke Po
2017-06-10 10:31:18 +08:00
committed by Jonathan Hui
parent 566930f7a8
commit 4909e1316a
2 changed files with 9 additions and 4 deletions
+7 -4
View File
@@ -56,9 +56,7 @@ otError utilsFlashInit(void)
char fileName[20];
struct stat st;
bool create = false;
struct timeval tv;
gettimeofday(&tv, NULL);
const char *offset = getenv("PORT_OFFSET");
memset(&st, 0, sizeof(st));
@@ -67,7 +65,12 @@ otError utilsFlashInit(void)
mkdir("tmp", 0777);
}
snprintf(fileName, sizeof(fileName), "tmp/%d_%d.flash", NODE_ID, (uint32_t)tv.tv_usec);
if (offset == NULL)
{
offset = "0";
}
snprintf(fileName, sizeof(fileName), "tmp/%s_%d.flash", offset, NODE_ID);
if (access(fileName, 0))
{
+2
View File
@@ -121,6 +121,8 @@ estatus=$?
# Return the offset
rm -rf "${lock_path}.${OFFSET}.lock.d"
# Remove the flash files
rm -f tmp/${OFFSET}_*.flash
if test $enable_hard_errors = no && test $estatus -eq 99; then
tweaked_estatus=1