diff options
Diffstat (limited to 'items.c')
-rw-r--r-- | items.c | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -169,7 +169,11 @@ static size_t item_make_header(const uint8_t nkey, const unsigned int flags, con /* suffix is defined at 40 chars elsewhere.. */ *nsuffix = (uint8_t) snprintf(suffix, 40, " %u %d\r\n", flags, nbytes - 2); } else { - *nsuffix = sizeof(flags); + if (flags == 0) { + *nsuffix = 0; + } else { + *nsuffix = sizeof(flags); + } } return sizeof(item) + nkey + *nsuffix + nbytes; } @@ -322,7 +326,7 @@ item *do_item_alloc(char *key, const size_t nkey, const unsigned int flags, it->exptime = exptime; if (settings.inline_ascii_response) { memcpy(ITEM_suffix(it), suffix, (size_t)nsuffix); - } else { + } else if (nsuffix > 0) { memcpy(ITEM_suffix(it), &flags, sizeof(flags)); } it->nsuffix = nsuffix; |