eina - Fix compilation warning in eina_log_print_cb_journald.

vasprintf can return -1, in which case the buffer is corrupted.
So we better handle this ...

gcc told me of this thanks to -Wunused-result when building package,
thank you gcc for your incredible powers.
This commit is contained in:
Guillaume Friloux 2014-01-03 19:13:30 +01:00
parent 1073bfcd44
commit ec3d13d6c9
1 changed files with 7 additions and 1 deletions

View File

@ -1907,8 +1907,14 @@ eina_log_print_cb_journald(const Eina_Log_Domain *d,
char buf[12];
char *tmp;
Eina_Thread cur;
int r;
vasprintf(&tmp, fmt, args);
r = vasprintf(&tmp, fmt, args);
if (r == -1)
{
fputs("ERR: eina_log_print_cb_journald() vasprintf failed\n");
return;
}
eina_convert_itoa(line, buf);