Merge branch 'master' of https://github.com/jeelabs/esp-link into TvEmaster

Fix merge conflict because of 1d0f313
* 'master' of https://github.com/jeelabs/esp-link:
  fixes #111: handle malloc failure in syslog
  fix slip protocol argument padding

Conflicts:
	syslog/syslog.c
pull/95/head
susisstrolch 10 years ago
commit 194afba5ca
  1. 4
      README.adoc
  2. 2
      cmd/cmd.c
  3. 11
      syslog/syslog.c

@ -24,8 +24,8 @@ but significantly reqritten and no longer protocol compatible, thanks to tuanpmt
inspiration!
Many thanks to https://github.com/brunnels for contributions in particular around the espduino
functionality. Thank you also to https://github.com/susisstrolch and https://github.com/bc547 for
additional contributions!
functionality. Thank you also to https://github.com/susisstrolch, https://github.com/bc547,
and https://github.com/katast for additional contributions!
[float]
Table of Contents

@ -63,7 +63,7 @@ cmdResponseBody(const void *data, uint16_t len) {
cmdProtoWriteBuf(data, len);
resp_crc = crc16_data(data, len, resp_crc);
uint16_t pad = (4-(len&3))&3; // get to multiple of 4
uint16_t pad = (4-((len+2)&3))&3; // get to multiple of 4
if (pad > 0) {
uint32_t temp = 0;
cmdProtoWriteBuf((uint8_t*)&temp, pad);

@ -391,11 +391,11 @@ syslog_compose(uint8_t facility, uint8_t severity, const char *tag, const char *
} sl;
DBG("[%dµs] %s id=%lu\n", WDEV_NOW(), __FUNCTION__, syslog_msgid);
sl.se.next = NULL;
sl.se.msgid = syslog_msgid;
sl.se.tick = WDEV_NOW(); // 0 ... 4294.967295s
char *p = sl.se.datagram;
syslog_entry_t *se = os_zalloc(sizeof (syslog_entry_t) + 1024); // allow up to 1k datagram
if (se == NULL) return NULL;
char *p = se->datagram;
se->tick = WDEV_NOW(); // 0 ... 4294.967295s
se->msgid = syslog_msgid;
// The Priority value is calculated by first multiplying the Facility
// number by 8 and then adding the numerical value of the Severity.
@ -527,6 +527,7 @@ void ICACHE_FLASH_ATTR syslog(uint8_t facility, uint8_t severity, const char *ta
// compose the syslog message
void *arg = __builtin_apply_args();
void *res = __builtin_apply((void*)syslog_compose, arg, 128);
if (res == NULL) return; // compose failed, probably due to malloc failure
syslog_entry_t *se = *(syslog_entry_t **)res;
// and append it to the message queue

Loading…
Cancel
Save