From 18a994a6bd010c8cc2aaf4ab71cac668456478f3 Mon Sep 17 00:00:00 2001 From: kpfleming Date: Mon, 3 Nov 2008 13:01:18 +0000 Subject: somehow missed a bunch of gcc 4.3.x warnings in this branch on the first pass git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@153823 f38db490-d61c-443f-a65b-d21fe96a405b --- main/file.c | 17 ++++++++++++----- main/http.c | 31 +++++++++++++++++-------------- main/utils.c | 7 +++++-- 3 files changed, 34 insertions(+), 21 deletions(-) (limited to 'main') diff --git a/main/file.c b/main/file.c index 45a033c55..d891000f7 100644 --- a/main/file.c +++ b/main/file.c @@ -265,11 +265,18 @@ static char *build_filename(const char *filename, const char *ext) if (!strcmp(ext, "wav49")) ext = "WAV"; - if (filename[0] == '/') - asprintf(&fn, "%s.%s", filename, ext); - else - asprintf(&fn, "%s/sounds/%s.%s", - ast_config_AST_DATA_DIR, filename, ext); + if (filename[0] == '/') { + if (asprintf(&fn, "%s.%s", filename, ext) < 0) { + ast_log(LOG_WARNING, "asprintf() failed: %s\n", strerror(errno)); + fn = NULL; + } + } else { + if (asprintf(&fn, "%s/sounds/%s.%s", + ast_config_AST_DATA_DIR, filename, ext) < 0) { + ast_log(LOG_WARNING, "asprintf() failed: %s\n", strerror(errno)); + fn = NULL; + } + } return fn; } diff --git a/main/http.c b/main/http.c index e164d554f..cee1d913c 100644 --- a/main/http.c +++ b/main/http.c @@ -231,20 +231,23 @@ static struct ast_http_uri staticuri = { char *ast_http_error(int status, const char *title, const char *extra_header, const char *text) { char *c = NULL; - asprintf(&c, - "Content-type: text/html\r\n" - "%s" - "\r\n" - "\r\n" - "\r\n" - "%d %s\r\n" - "\r\n" - "

%s

\r\n" - "

%s

\r\n" - "
\r\n" - "
Asterisk Server
\r\n" - "\r\n", - (extra_header ? extra_header : ""), status, title, title, text); + if (asprintf(&c, + "Content-type: text/html\r\n" + "%s" + "\r\n" + "\r\n" + "\r\n" + "%d %s\r\n" + "\r\n" + "

%s

\r\n" + "

%s

\r\n" + "
\r\n" + "
Asterisk Server
\r\n" + "\r\n", + (extra_header ? extra_header : ""), status, title, title, text) < 0) { + ast_log(LOG_WARNING, "asprintf() failed: %s\n", strerror(errno)); + c = NULL; + } return c; } diff --git a/main/utils.c b/main/utils.c index 9749949e1..a802fd324 100644 --- a/main/utils.c +++ b/main/utils.c @@ -954,8 +954,11 @@ int ast_pthread_create_stack(pthread_t *thread, pthread_attr_t *attr, void *(*st a->start_routine = start_routine; a->data = data; start_routine = dummy_start; - asprintf(&a->name, "%-20s started at [%5d] %s %s()", - start_fn, line, file, caller); + if (asprintf(&a->name, "%-20s started at [%5d] %s %s()", + start_fn, line, file, caller) < 0) { + ast_log(LOG_WARNING, "asprintf() failed: %s\n", strerror(errno)); + a->name = NULL; + } data = a; } #endif /* !LOW_MEMORY */ -- cgit v1.2.3