From 28c662e7a422314475cca61663695dd31fd86546 Mon Sep 17 00:00:00 2001 From: Allan McRae Date: Mon, 27 Sep 2010 15:30:39 +1000 Subject: Add wrapper around asprintf calls Not checking the return value of asprintf calls reuslts in a warning when using -D_FORTIRFY_SOURCE=2. This adds a simple wrapper around asprintf calls which checks the return value. Currently the check does nothing more than outputing a message to stderr on failure, but that is at least an improvement over silent failures. Signed-off-by: Allan McRae --- src/pacman/util.h | 1 + 1 file changed, 1 insertion(+) (limited to 'src/pacman/util.h') diff --git a/src/pacman/util.h b/src/pacman/util.h index d85ba7b6..2e77b0c4 100644 --- a/src/pacman/util.h +++ b/src/pacman/util.h @@ -62,6 +62,7 @@ int yesno(char *fmt, ...); int noyes(char *fmt, ...); int pm_printf(pmloglevel_t level, const char *format, ...) __attribute__((format(printf,2,3))); int pm_fprintf(FILE *stream, pmloglevel_t level, const char *format, ...) __attribute__((format(printf,3,4))); +int pm_asprintf(char **string, const char *format, ...); int pm_vfprintf(FILE *stream, pmloglevel_t level, const char *format, va_list args) __attribute__((format(printf,3,0))); int pm_vasprintf(char **string, pmloglevel_t level, const char *format, va_list args) __attribute__((format(printf,3,0))); -- cgit v1.2.3-54-g00ecf