Browse Source

hardfault_log:Not having a ulog file to append to is not an error

The hardfault keeps track of the number of reboot without a
   commit to disk. A commit to disk is the act of writing the
   fault data from the bbsram to the hardfault file, not the
   ulog file. The sucessful commit rearms the hardfault system.

   When ulog appending was added it treated the lack of a ulog
   file as an error. This prevented the hardfault_log reset
   from being called because the hardfault_log commit returned
   an error.

   	if hardfault_log check
	then
		if hardfault_log commit
		then
			hardfault_log reset
		fi
	fi

   This change treats the lack a a ulog as a non error.
sbg
David Sidrane 7 years ago
parent
commit
391d103bfd
  1. 19
      src/systemcmds/hardfault_log/hardfault_log.c

19
src/systemcmds/hardfault_log/hardfault_log.c

@ -617,6 +617,10 @@ static int hardfault_append_to_ulog(const char *caller, int fdin) @@ -617,6 +617,10 @@ static int hardfault_append_to_ulog(const char *caller, int fdin)
close(fd);
ulog_file_name[HARDFAULT_MAX_ULOG_FILE_LEN - 1] = 0; //ensure null-termination
if (strlen(ulog_file_name) == 0) {
return -ENOENT;
}
identify(caller);
syslog(LOG_INFO, "Appending to ULog %s\n", ulog_file_name);
@ -823,14 +827,21 @@ static int hardfault_commit(char *caller) @@ -823,14 +827,21 @@ static int hardfault_commit(char *caller)
// .txt file around, since that is a bit less prone to FS errors than the ULog
if (ret == OK) {
ret = hardfault_append_to_ulog(caller, fdout);
identify(caller);
if (ret == OK) {
identify(caller);
switch (ret) {
case OK:
syslog(LOG_INFO, "Successfully appended to ULog\n");
break;
case -ENOENT:
syslog(LOG_INFO, "No ULog to append to\n");
ret = OK;
break;
} else {
identify(caller);
default:
syslog(LOG_INFO, "Failed to append to ULog (%i)\n", ret);
break;
}
}

Loading…
Cancel
Save