Author: mikej Date: Fri Aug 3 17:29:01 2007 New Revision: 5566 Removed: freeswitch/trunk/scripts/contrib/trixter/newgcc-2.svndiff freeswitch/trunk/scripts/contrib/trixter/newgcc.svndiff Modified: freeswitch/trunk/src/mod/applications/mod_commands/mod_commands.c freeswitch/trunk/src/mod/applications/mod_dptools/mod_dptools.c freeswitch/trunk/src/mod/endpoints/mod_iax/mod_iax.c freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_presence.c freeswitch/trunk/src/mod/event_handlers/mod_event_socket/mod_event_socket.c freeswitch/trunk/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c freeswitch/trunk/src/mod/languages/mod_spidermonkey_etpan/mod_spidermonkey_etpan.c freeswitch/trunk/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.c freeswitch/trunk/src/switch.c freeswitch/trunk/src/switch_core.c freeswitch/trunk/src/switch_ivr_originate.c freeswitch/trunk/src/switch_xml.c Log: fix for FSCORE-40 Modified: freeswitch/trunk/src/mod/applications/mod_commands/mod_commands.c ============================================================================== --- freeswitch/trunk/src/mod/applications/mod_commands/mod_commands.c (original) +++ freeswitch/trunk/src/mod/applications/mod_commands/mod_commands.c Fri Aug 3 17:29:01 2007 @@ -1059,7 +1059,8 @@ } snprintf(id, sizeof(id), "%d", holder->rows); - switch_xml_set_attr_d(row, "row_id", id); + + switch_xml_set_attr(switch_xml_set_flag(row, SWITCH_XML_DUP), strdup("row_id"), strdup(id)); for(x = 0; x < argc; x++) { char *name = columnNames[x]; @@ -1229,7 +1230,8 @@ char count[50]; char *xmlstr; snprintf(count, sizeof(count), "%d", holder.count); - switch_xml_set_attr_d(holder.xml, "row_count", count); + + switch_xml_set_attr(switch_xml_set_flag(holder.xml, SWITCH_XML_DUP), strdup("row_count"), strdup(count)); xmlstr = switch_xml_toxml(holder.xml); if (xmlstr) { Modified: freeswitch/trunk/src/mod/applications/mod_dptools/mod_dptools.c ============================================================================== --- freeswitch/trunk/src/mod/applications/mod_dptools/mod_dptools.c (original) +++ freeswitch/trunk/src/mod/applications/mod_dptools/mod_dptools.c Fri Aug 3 17:29:01 2007 @@ -724,7 +724,9 @@ SWITCH_STANDARD_APP(system_session_function) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Executing command: %s\n",data); - system(data); + if(!system(data)) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Failed to execute command: %s\n",data); + } } SWITCH_STANDARD_APP(tone_detect_session_function) Modified: freeswitch/trunk/src/mod/endpoints/mod_iax/mod_iax.c ============================================================================== --- freeswitch/trunk/src/mod/endpoints/mod_iax/mod_iax.c (original) +++ freeswitch/trunk/src/mod/endpoints/mod_iax/mod_iax.c Fri Aug 3 17:29:01 2007 @@ -278,8 +278,8 @@ char pref_str[256] = "("; for (x = 0; x < len; x++) { - strncat(pref_str, ast2str(prefs[x]), sizeof(pref_str)); - strncat(pref_str, x == len - 1 ? ")" : ",", sizeof(pref_str)); + strncat(pref_str, ast2str(prefs[x]), sizeof(pref_str)-1); + strncat(pref_str, x == len - 1 ? ")" : ",", sizeof(pref_str)-1); } switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Codec Prefs Detected: %s\n", pref_str); Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c ============================================================================== --- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c (original) +++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c Fri Aug 3 17:29:01 2007 @@ -1785,7 +1785,7 @@ } switch_mutex_init(&tech_pvt->flag_mutex, SWITCH_MUTEX_NESTED, switch_core_session_get_pool(session)); - if (!switch_strlen_zero(key)) { + if (*key != '\0') { tech_pvt->key = switch_core_session_strdup(session, key); } Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c ============================================================================== --- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c (original) +++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c Fri Aug 3 17:29:01 2007 @@ -582,10 +582,10 @@ } nua_invite(tech_pvt->nh, - TAG_IF(!switch_strlen_zero(rpid), SIPTAG_HEADER_STR(rpid)), - TAG_IF(!switch_strlen_zero(alert_info), SIPTAG_HEADER_STR(alert_info)), + TAG_IF(*rpid != '\0', SIPTAG_HEADER_STR(rpid)), + TAG_IF(*alert_info != '\0', SIPTAG_HEADER_STR(alert_info)), TAG_IF(!switch_strlen_zero(extra_headers), SIPTAG_HEADER_STR(extra_headers)), - TAG_IF(!switch_strlen_zero(max_forwards), SIPTAG_MAX_FORWARDS_STR(max_forwards)), + TAG_IF(*max_forwards != '\0', SIPTAG_MAX_FORWARDS_STR(max_forwards)), SOATAG_USER_SDP_STR(tech_pvt->local_sdp_str), SOATAG_RTP_SORT(SOA_RTP_SORT_REMOTE), SOATAG_RTP_SELECT(SOA_RTP_SELECT_ALL), TAG_IF(rep, SIPTAG_REPLACES_STR(rep)), SOATAG_HOLD(holdstr), TAG_END()); @@ -600,7 +600,6 @@ void sofia_glue_do_xfer_invite(switch_core_session_t *session) { - char rpid[1024]; private_object_t *tech_pvt; switch_channel_t *channel = NULL; switch_caller_profile_t *caller_profile; @@ -630,7 +629,6 @@ nua_handle_bind(tech_pvt->nh2, tech_pvt->sofia_private); nua_invite(tech_pvt->nh2, - TAG_IF(rpid, SIPTAG_HEADER_STR(rpid)), SIPTAG_CONTACT_STR(tech_pvt->profile->url), SOATAG_USER_SDP_STR(tech_pvt->local_sdp_str), SOATAG_RTP_SORT(SOA_RTP_SORT_REMOTE), SOATAG_RTP_SELECT(SOA_RTP_SELECT_ALL), TAG_IF(rep, SIPTAG_REPLACES_STR(rep)), TAG_END()); @@ -1092,7 +1090,7 @@ if (!strcasecmp(a->a_name, "sendonly")) { sendonly = 1; - } else if (!strcasecmp(a->a_name, "sendrecv")) { + } else if (!strcasecmp(a->a_name, "sendrecv")) { sendonly = 0; } else if (!strcasecmp(a->a_name, "ptime")) { dptime = atoi(a->a_value); Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_presence.c ============================================================================== --- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_presence.c (original) +++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_presence.c Fri Aug 3 17:29:01 2007 @@ -1033,7 +1033,7 @@ if ((ci = switch_loadable_module_get_chat_interface(proto))) { ci->chat_send(SOFIA_CHAT_PROTO, from_addr, to_addr, "", msg, full_from); } else { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid Chat Interface [%s]!\n", proto ? proto : "(none)"); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid Chat Interface [%s]!\n", proto); } } Modified: freeswitch/trunk/src/mod/event_handlers/mod_event_socket/mod_event_socket.c ============================================================================== --- freeswitch/trunk/src/mod/event_handlers/mod_event_socket/mod_event_socket.c (original) +++ freeswitch/trunk/src/mod/event_handlers/mod_event_socket/mod_event_socket.c Fri Aug 3 17:29:01 2007 @@ -1065,7 +1065,7 @@ switch_clear_flag_locked(listener, LFLAG_RUNNING); goto done; } - if (!switch_strlen_zero(reply)) { + if (*reply != '\0') { snprintf(buf, sizeof(buf), "Content-Type: command/reply\nReply-Text: %s\n\n", reply); len = strlen(buf); switch_socket_send(listener->sock, buf, &len); @@ -1094,7 +1094,7 @@ break; } - if (!switch_strlen_zero(reply)) { + if (*reply != '\0') { snprintf(buf, sizeof(buf), "Content-Type: command/reply\nReply-Text: %s\n\n", reply); len = strlen(buf); switch_socket_send(listener->sock, buf, &len); Modified: freeswitch/trunk/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c ============================================================================== --- freeswitch/trunk/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c (original) +++ freeswitch/trunk/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c Fri Aug 3 17:29:01 2007 @@ -715,7 +715,7 @@ } -static switch_status_t sm_load_module(char *dir, char *fname) +static switch_status_t sm_load_module(const char *dir, const char *fname) { switch_size_t len = 0; char *path; @@ -788,7 +788,7 @@ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Invalid extension for %s\n", val); continue; } - sm_load_module((char *) SWITCH_GLOBAL_dirs.mod_dir, (char *) val); + sm_load_module(SWITCH_GLOBAL_dirs.mod_dir, val); count++; } } @@ -1964,7 +1964,9 @@ register unsigned int realsize = (unsigned int) (size * nmemb); struct config_data *config_data = data; - write(config_data->fd, ptr, realsize); + if ((write(config_data->fd, ptr, realsize) != (int)realsize)) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unable to write all bytes!\n"); + } return realsize; } Modified: freeswitch/trunk/src/mod/languages/mod_spidermonkey_etpan/mod_spidermonkey_etpan.c ============================================================================== --- freeswitch/trunk/src/mod/languages/mod_spidermonkey_etpan/mod_spidermonkey_etpan.c (original) +++ freeswitch/trunk/src/mod/languages/mod_spidermonkey_etpan/mod_spidermonkey_etpan.c Fri Aug 3 17:29:01 2007 @@ -180,7 +180,10 @@ close(ifd); } snprintf(buf, B64BUFFLEN, "/bin/cat %s | /usr/sbin/sendmail -tf \"%s\" %s", filename, from, to); - system(buf); + if(!system(buf)) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unable to execute command: %s\n",buf); + } + unlink(filename); Modified: freeswitch/trunk/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.c ============================================================================== --- freeswitch/trunk/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.c (original) +++ freeswitch/trunk/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.c Fri Aug 3 17:29:01 2007 @@ -327,12 +327,12 @@ if (action) { if (switch_core_management_exec(relative_oid, action, buf, sizeof(buf)) == SWITCH_STATUS_SUCCESS) { if (action == SMA_SET) { - if (switch_strlen_zero(buf)) { + if (*buf != '\0') { snprintf(buf, sizeof(buf), "OK\n"); } } } else { - if (switch_strlen_zero(buf)) { + if (*buf != '\0') { snprintf(buf, sizeof(buf), "ERROR\n"); } } Modified: freeswitch/trunk/src/switch.c ============================================================================== --- freeswitch/trunk/src/switch.c (original) +++ freeswitch/trunk/src/switch.c Fri Aug 3 17:29:01 2007 @@ -96,7 +96,9 @@ } /* pull the pid from the file */ - fscanf(f, "%d", &pid); + if(fscanf(f, "%d", &pid)!=1) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,"Unable to get the pid!\n"); + } /* if we have a valid pid */ if (pid > 0) { Modified: freeswitch/trunk/src/switch_core.c ============================================================================== --- freeswitch/trunk/src/switch_core.c (original) +++ freeswitch/trunk/src/switch_core.c Fri Aug 3 17:29:01 2007 @@ -355,7 +355,9 @@ #ifdef WIN32 SetPriorityClass(GetCurrentProcess(), HIGH_PRIORITY_CLASS); #else - nice(-10); + if(nice(-10)!= -10) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Could not set nice level\n"); + } #endif #define USE_MLOCKALL Modified: freeswitch/trunk/src/switch_ivr_originate.c ============================================================================== --- freeswitch/trunk/src/switch_ivr_originate.c (original) +++ freeswitch/trunk/src/switch_ivr_originate.c Fri Aug 3 17:29:01 2007 @@ -373,7 +373,7 @@ fail_on_single_reject = 1; } - if ((!switch_strlen_zero(file)) && (!strcmp(file, "undef"))) { + if ((*file != '\0') && (!strcmp(file, "undef"))) { *file = '\0'; } Modified: freeswitch/trunk/src/switch_xml.c ============================================================================== --- freeswitch/trunk/src/switch_xml.c (original) +++ freeswitch/trunk/src/switch_xml.c Fri Aug 3 17:29:01 2007 @@ -966,12 +966,16 @@ } } - if ((cmd = strstr(bp, "<!--#"))) { - write(write_fd, bp, (unsigned) (cmd - bp)); + if ((cmd = strstr(bp, "<!--#"))) { + if(write(write_fd, bp, (unsigned) (cmd - bp)) != (cmd - bp)) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Short write!\n"); + } if ((e = strstr(cmd, "-->"))) { *e = '\0'; - e += 3; - write(write_fd, e, (unsigned) strlen(e)); + e += 3; + if(write(write_fd, e, (unsigned) strlen(e)) != (int) strlen(e)) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Short write!\n"); + } } else { ml++; } @@ -1027,8 +1031,11 @@ continue; } - - write(write_fd, bp, (unsigned) cur); + + if(write(write_fd, bp, (unsigned) cur) != (int) cur) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Short write!\n"); + } + } close(read_fd);