if asprintf fails, string content becomes invalid. we need
to check if it ran OK by checking the returned value.

in case of fail, asprintf returns -1, otherwise the number
of writen bytes is returned.

also, on ubuntu 13.10 i've receiving a lot of warnings:

"warning: ignoring return value of ‘asprintf’"

this patches fixes some of them

Signed-off-by: Ricardo Maraschini <[email protected]>
---
Closes #1227
You can merge this Pull Request by running:

  git pull https://github.com/waja/monitoring-plugins github1227

Or you can view, comment on it, or merge it online at:

  https://github.com/monitoring-plugins/monitoring-plugins/pull/1278

-- Commit Summary --

  * lib/utils_base.c: if asprintf fails, string is undefined

-- File Changes --

    M lib/utils_base.c (15)

-- Patch Links --

https://github.com/monitoring-plugins/monitoring-plugins/pull/1278.patch
https://github.com/monitoring-plugins/monitoring-plugins/pull/1278.diff

---
Reply to this email directly or view it on GitHub:
https://github.com/monitoring-plugins/monitoring-plugins/pull/1278

Reply via email to