}
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];
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) {
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)
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);
}
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);
}
}
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());
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;
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());
if (!strcasecmp(a->a_name, "sendonly")) {
sendonly = 1;
- } else if (!strcasecmp(a->a_name, "sendrecv")) {\r
+ } else if (!strcasecmp(a->a_name, "sendrecv")) {
sendonly = 0;
} else if (!strcasecmp(a->a_name, "ptime")) {
dptime = atoi(a->a_value);
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);
}
}
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);
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);
}
-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;
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++;
}
}
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;
}
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);
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");
}
}
}
/* 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) {
#ifdef WIN32
SetPriorityClass(GetCurrentProcess(), HIGH_PRIORITY_CLASS);
#else
- nice(-10);
+ if(nice(-10)!= -10) {\r
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Could not set nice level\n");\r
+ }\r
#endif
#define USE_MLOCKALL
fail_on_single_reject = 1;
}
- if ((!switch_strlen_zero(file)) && (!strcmp(file, "undef"))) {
+ if ((*file != '\0') && (!strcmp(file, "undef"))) {
*file = '\0';
}
}
}
- if ((cmd = strstr(bp, "<!--#"))) {
- write(write_fd, bp, (unsigned) (cmd - bp));
+ if ((cmd = strstr(bp, "<!--#"))) {\r
+ if(write(write_fd, bp, (unsigned) (cmd - bp)) != (cmd - bp)) {\r
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Short write!\n");\r
+ }\r
if ((e = strstr(cmd, "-->"))) {
*e = '\0';
- e += 3;
- write(write_fd, e, (unsigned) strlen(e));
+ e += 3;\r
+ if(write(write_fd, e, (unsigned) strlen(e)) != (int) strlen(e)) {\r
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Short write!\n");\r
+ }\r
} else {
ml++;
}
continue;
}
-
- write(write_fd, bp, (unsigned) cur);
+\r
+ if(write(write_fd, bp, (unsigned) cur) != (int) cur) {\r
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Short write!\n");\r
+ }\r
+\r
}
close(read_fd);