mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-14 02:27:39 -04:00
Don't add new message to logf when we dump it to file
Fix log file corruption if we have new messages at dumping log to file. Comment removed as it incorrect. We store all messages in direct order (last message at end of file). Change-Id: I4acfa8a0935cc41a889e08f6bc42974fefd1ade2
This commit is contained in:
parent
26beb30c15
commit
e599810ffa
3 changed files with 16 additions and 9 deletions
|
@ -218,9 +218,6 @@ bool logfdisplay(void)
|
|||
}
|
||||
#endif /* HAVE_LCD_BITMAP */
|
||||
|
||||
/* Store the logf log to logf.txt in the .rockbox directory. The order of the
|
||||
* entries will be "reversed" so that the most recently logged entry is on the
|
||||
* top of the file */
|
||||
bool logfdump(void)
|
||||
{
|
||||
int fd;
|
||||
|
@ -232,6 +229,8 @@ bool logfdump(void)
|
|||
/* nothing is logged just yet */
|
||||
return false;
|
||||
|
||||
logfenabled = false;
|
||||
|
||||
fd = open(ROCKBOX_DIR "/logf.txt", O_CREAT|O_WRONLY|O_TRUNC, 0666);
|
||||
if(-1 != fd) {
|
||||
int i;
|
||||
|
@ -254,6 +253,9 @@ bool logfdump(void)
|
|||
|
||||
close(fd);
|
||||
}
|
||||
|
||||
logfenabled = true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
extern unsigned char logfbuffer[MAX_LOGF_SIZE];
|
||||
extern int logfindex;
|
||||
extern bool logfwrap;
|
||||
extern bool logfenabled;
|
||||
#endif /* __PCTOOL__ */
|
||||
|
||||
#define logf _logf
|
||||
|
|
|
@ -62,6 +62,7 @@ static int logdiskfindex;
|
|||
unsigned char logfbuffer[MAX_LOGF_SIZE];
|
||||
int logfindex;
|
||||
bool logfwrap;
|
||||
bool logfenabled = true;
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_REMOTE_LCD
|
||||
|
@ -214,6 +215,9 @@ static int logf_push(void *userp, unsigned char c)
|
|||
|
||||
void _logf(const char *fmt, ...)
|
||||
{
|
||||
if (!logfenabled)
|
||||
return;
|
||||
|
||||
#ifdef USB_ENABLE_SERIAL
|
||||
int old_logfindex = logfindex;
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue