2
0
mirror of https://gitlab.com/apparmor/apparmor synced 2025-08-31 06:16:03 +00:00

Fix compiler warnings about format specifiers with DEBUG set

As for %s when the pointer is null: even if gcc prints (null) this is still undefined behavior, so we should do this explicitly

Signed-off-by: Ryan Lee <ryan.lee@canonical.com>
This commit is contained in:
Ryan Lee
2024-10-16 12:26:54 -07:00
parent 6d20a10606
commit 776c56bd7e
2 changed files with 2 additions and 2 deletions

View File

@@ -245,7 +245,7 @@ static inline void sd_write_uint64(std::ostringstream &buf, u64 b)
static inline void sd_write_name(std::ostringstream &buf, const char *name)
{
PDEBUG("Writing name '%s'\n", name);
PDEBUG("Writing name '%s'\n", name ? name : "(null)");
if (name) {
sd_write8(buf, SD_NAME);
sd_write16(buf, strlen(name) + 1);