mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06: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);
|
journalAddInt(&state, "PRIORITY", priority);
|
||||||
journalAddString(&state, "LIBVIRT_SOURCE",
|
journalAddString(&state, "LIBVIRT_SOURCE",
|
||||||
virLogSourceTypeToString(source));
|
virLogSourceTypeToString(source));
|
||||||
journalAddString(&state, "CODE_FILE", filename);
|
if (filename)
|
||||||
|
journalAddString(&state, "CODE_FILE", filename);
|
||||||
journalAddInt(&state, "CODE_LINE", linenr);
|
journalAddInt(&state, "CODE_LINE", linenr);
|
||||||
journalAddString(&state, "CODE_FUNC", funcname);
|
if (funcname)
|
||||||
|
journalAddString(&state, "CODE_FUNC", funcname);
|
||||||
|
|
||||||
memset(&sa, 0, sizeof(sa));
|
memset(&sa, 0, sizeof(sa));
|
||||||
sa.sun_family = AF_UNIX;
|
sa.sun_family = AF_UNIX;
|
||||||
|
Loading…
Reference in New Issue
Block a user