mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-22 12:35:17 +00:00
Avoid crash if NULL is passed for filename/funcname in logging
The journald code would crash if a NULL was passed for the filename / funcname in the logging code. This shouldn't happen in general, but it is better to be safe, since there have been bugs triggering this. Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
This commit is contained in:
parent
cb3868f701
commit
b4ca299902
@ -1181,9 +1181,11 @@ virLogOutputToJournald(virLogSource source,
|
||||
journalAddInt(&state, "PRIORITY", priority);
|
||||
journalAddString(&state, "LIBVIRT_SOURCE",
|
||||
virLogSourceTypeToString(source));
|
||||
journalAddString(&state, "CODE_FILE", filename);
|
||||
if (filename)
|
||||
journalAddString(&state, "CODE_FILE", filename);
|
||||
journalAddInt(&state, "CODE_LINE", linenr);
|
||||
journalAddString(&state, "CODE_FUNC", funcname);
|
||||
if (funcname)
|
||||
journalAddString(&state, "CODE_FUNC", funcname);
|
||||
|
||||
memset(&sa, 0, sizeof(sa));
|
||||
sa.sun_family = AF_UNIX;
|
||||
|
Loading…
x
Reference in New Issue
Block a user