From ee246d0e0519c6aa7cb0aea17ea92c9a5c2dc16f Mon Sep 17 00:00:00 2001 From: kpfleming Date: Sun, 2 Nov 2008 23:56:13 +0000 Subject: import gcc 4.3.2 warning fixes from trunk, with a few changes specific to this branch git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.6.1@153710 f38db490-d61c-443f-a65b-d21fe96a405b --- pbx/pbx_config.c | 10 ++++++++-- pbx/pbx_dundi.c | 9 +++++++-- pbx/pbx_lua.c | 4 +++- 3 files changed, 18 insertions(+), 5 deletions(-) (limited to 'pbx') diff --git a/pbx/pbx_config.c b/pbx/pbx_config.c index 2d93fd8fe..bd4390e97 100644 --- a/pbx/pbx_config.c +++ b/pbx/pbx_config.c @@ -492,10 +492,16 @@ static char *complete_dialplan_remove_extension(struct ast_cli_args *a) if (++which > a->n) { /* If there is an extension then return exten@context. */ if (ast_get_extension_matchcid(e) && (!strchr(a->word, '@') || strchr(a->word, '/'))) { - asprintf(&ret, "%s/%s@%s", ast_get_extension_name(e), ast_get_extension_cidmatch(e), ast_get_context_name(c)); + if (asprintf(&ret, "%s/%s@%s", ast_get_extension_name(e), ast_get_extension_cidmatch(e), ast_get_context_name(c)) < 0) { + ast_log(LOG_WARNING, "asprintf() failed: %s\n", strerror(errno)); + ret = NULL; + } break; } else if (!ast_get_extension_matchcid(e) && !strchr(a->word, '/')) { - asprintf(&ret, "%s@%s", ast_get_extension_name(e), ast_get_context_name(c)); + if (asprintf(&ret, "%s@%s", ast_get_extension_name(e), ast_get_context_name(c)) < 0) { + ast_log(LOG_WARNING, "asprintf() failed: %s\n", strerror(errno)); + ret = NULL; + } break; } } diff --git a/pbx/pbx_dundi.c b/pbx/pbx_dundi.c index 5d3a0be12..12ab1328d 100644 --- a/pbx/pbx_dundi.c +++ b/pbx/pbx_dundi.c @@ -2958,7 +2958,9 @@ static void destroy_trans(struct dundi_transaction *trans, int fromtimeout) if (AST_LIST_EMPTY(&trans->parent->trans)) { /* Wake up sleeper */ if (trans->parent->pfds[1] > -1) { - write(trans->parent->pfds[1], "killa!", 6); + if (write(trans->parent->pfds[1], "killa!", 6) < 0) { + ast_log(LOG_WARNING, "write() failed: %s\n", strerror(errno)); + } } } } @@ -3725,7 +3727,10 @@ static int dundi_precache_internal(const char *context, const char *number, int dr.expiration = dundi_cache_time; dr.hmd = &hmd; dr.pfds[0] = dr.pfds[1] = -1; - pipe(dr.pfds); + if (pipe(dr.pfds) < 0) { + ast_log(LOG_WARNING, "pipe() failed: %s\n", strerror(errno)); + return -1; + } build_transactions(&dr, ttl, 0, &foundcache, &skipped, 0, 1, 1, NULL, avoids, NULL); optimize_transactions(&dr, 0); foundanswers = 0; diff --git a/pbx/pbx_lua.c b/pbx/pbx_lua.c index ba6a7c456..7bc1a8ad1 100644 --- a/pbx/pbx_lua.c +++ b/pbx/pbx_lua.c @@ -946,7 +946,9 @@ static char *lua_read_extensions_file(lua_State *L, long *size) return NULL; } - fread(data, sizeof(char), *size, f); + if (fread(data, sizeof(char), *size, f) != *size) { + ast_log(LOG_WARNING, "fread() failed: %s\n", strerror(errno)); + } fclose(f); if (luaL_loadbuffer(L, data, *size, "extensions.lua") -- cgit v1.2.3