From: Todd C. Miller Date: Wed, 10 May 2000 05:10:33 +0000 (+0000) Subject: Make easprintf() and evasprintf() return an int. X-Git-Tag: SUDO_1_6_4~273 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b00e117e31397dcee5a1badd3b08849357308140;p=sudo Make easprintf() and evasprintf() return an int. --- diff --git a/alloc.c b/alloc.c index b54ab30ff..930deb974 100644 --- a/alloc.c +++ b/alloc.c @@ -121,7 +121,7 @@ estrdup(src) * easprintf() calls vasprintf() and exits with an error if vasprintf() * returns -1 (out of memory). */ -void +int #ifdef __STDC__ easprintf(char **ret, const char *fmt, ...) #else @@ -148,21 +148,24 @@ easprintf(va_alist) (void) fprintf(stderr, "%s: cannot allocate memory!\n", Argv[0]); exit(1); } + return(len); } /* * evasprintf() calls vasprintf() and exits with an error if vasprintf() * returns -1 (out of memory). */ -void +int evasprintf(ret, format, args) char **ret; const char *format; va_list args; { + int len; - if (vasprintf(ret, format, args) == -1) { + if ((len = vasprintf(ret, format, args)) == -1) { (void) fprintf(stderr, "%s: cannot allocate memory!\n", Argv[0]); exit(1); } + return(len); }