mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-04-17 01:02:12 +00:00
freeswitch: Use switch_strlen_zero() to check for empty strings.
Signed-off-by: Stefan Knoblich <stkn@openisdn.net>
This commit is contained in:
parent
ba428a1559
commit
d6a395b642
24
src/switch.c
24
src/switch.c
@ -437,7 +437,7 @@ int main(int argc, char *argv[])
|
|||||||
if (local_argv[x] && !strcmp(local_argv[x], "-service")) {
|
if (local_argv[x] && !strcmp(local_argv[x], "-service")) {
|
||||||
/* New installs will always have the service name specified, but keep a default for compat */
|
/* New installs will always have the service name specified, but keep a default for compat */
|
||||||
x++;
|
x++;
|
||||||
if (local_argv[x] && strlen(local_argv[x])) {
|
if (!switch_strlen_zero(local_argv[x])) {
|
||||||
switch_copy_string(service_name, local_argv[x], SERVICENAME_MAXLEN);
|
switch_copy_string(service_name, local_argv[x], SERVICENAME_MAXLEN);
|
||||||
} else {
|
} else {
|
||||||
switch_copy_string(service_name, SERVICENAME_DEFAULT, SERVICENAME_MAXLEN);
|
switch_copy_string(service_name, SERVICENAME_DEFAULT, SERVICENAME_MAXLEN);
|
||||||
@ -450,7 +450,7 @@ int main(int argc, char *argv[])
|
|||||||
char exePath[1024];
|
char exePath[1024];
|
||||||
char servicePath[1024];
|
char servicePath[1024];
|
||||||
x++;
|
x++;
|
||||||
if (local_argv[x] && strlen(local_argv[x])) {
|
if (!switch_strlen_zero(local_argv[x])) {
|
||||||
switch_copy_string(service_name, local_argv[x], SERVICENAME_MAXLEN);
|
switch_copy_string(service_name, local_argv[x], SERVICENAME_MAXLEN);
|
||||||
} else {
|
} else {
|
||||||
switch_copy_string(service_name, SERVICENAME_DEFAULT, SERVICENAME_MAXLEN);
|
switch_copy_string(service_name, SERVICENAME_DEFAULT, SERVICENAME_MAXLEN);
|
||||||
@ -485,7 +485,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
if (local_argv[x] && !strcmp(local_argv[x], "-uninstall")) {
|
if (local_argv[x] && !strcmp(local_argv[x], "-uninstall")) {
|
||||||
x++;
|
x++;
|
||||||
if (local_argv[x] && strlen(local_argv[x])) {
|
if (!switch_strlen_zero(local_argv[x])) {
|
||||||
switch_copy_string(service_name, local_argv[x], SERVICENAME_MAXLEN);
|
switch_copy_string(service_name, local_argv[x], SERVICENAME_MAXLEN);
|
||||||
} else {
|
} else {
|
||||||
switch_copy_string(service_name, SERVICENAME_DEFAULT, SERVICENAME_MAXLEN);
|
switch_copy_string(service_name, SERVICENAME_DEFAULT, SERVICENAME_MAXLEN);
|
||||||
@ -521,7 +521,7 @@ int main(int argc, char *argv[])
|
|||||||
#else
|
#else
|
||||||
if (local_argv[x] && !strcmp(local_argv[x], "-u")) {
|
if (local_argv[x] && !strcmp(local_argv[x], "-u")) {
|
||||||
x++;
|
x++;
|
||||||
if (local_argv[x] && strlen(local_argv[x])) {
|
if (!switch_strlen_zero(local_argv[x])) {
|
||||||
runas_user = local_argv[x];
|
runas_user = local_argv[x];
|
||||||
}
|
}
|
||||||
known_opt++;
|
known_opt++;
|
||||||
@ -529,7 +529,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
if (local_argv[x] && !strcmp(local_argv[x], "-g")) {
|
if (local_argv[x] && !strcmp(local_argv[x], "-g")) {
|
||||||
x++;
|
x++;
|
||||||
if (local_argv[x] && strlen(local_argv[x])) {
|
if (!switch_strlen_zero(local_argv[x])) {
|
||||||
runas_group = local_argv[x];
|
runas_group = local_argv[x];
|
||||||
}
|
}
|
||||||
known_opt++;
|
known_opt++;
|
||||||
@ -641,7 +641,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
if (local_argv[x] && !strcmp(local_argv[x], "-conf")) {
|
if (local_argv[x] && !strcmp(local_argv[x], "-conf")) {
|
||||||
x++;
|
x++;
|
||||||
if (local_argv[x] && strlen(local_argv[x])) {
|
if (!switch_strlen_zero(local_argv[x])) {
|
||||||
SWITCH_GLOBAL_dirs.conf_dir = (char *) malloc(strlen(local_argv[x]) + 1);
|
SWITCH_GLOBAL_dirs.conf_dir = (char *) malloc(strlen(local_argv[x]) + 1);
|
||||||
if (!SWITCH_GLOBAL_dirs.conf_dir) {
|
if (!SWITCH_GLOBAL_dirs.conf_dir) {
|
||||||
fprintf(stderr, "Allocation error\n");
|
fprintf(stderr, "Allocation error\n");
|
||||||
@ -658,7 +658,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
if (local_argv[x] && !strcmp(local_argv[x], "-mod")) {
|
if (local_argv[x] && !strcmp(local_argv[x], "-mod")) {
|
||||||
x++;
|
x++;
|
||||||
if (local_argv[x] && strlen(local_argv[x])) {
|
if (!switch_strlen_zero(local_argv[x])) {
|
||||||
SWITCH_GLOBAL_dirs.mod_dir = (char *) malloc(strlen(local_argv[x]) + 1);
|
SWITCH_GLOBAL_dirs.mod_dir = (char *) malloc(strlen(local_argv[x]) + 1);
|
||||||
if (!SWITCH_GLOBAL_dirs.mod_dir) {
|
if (!SWITCH_GLOBAL_dirs.mod_dir) {
|
||||||
fprintf(stderr, "Allocation error\n");
|
fprintf(stderr, "Allocation error\n");
|
||||||
@ -674,7 +674,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
if (local_argv[x] && !strcmp(local_argv[x], "-log")) {
|
if (local_argv[x] && !strcmp(local_argv[x], "-log")) {
|
||||||
x++;
|
x++;
|
||||||
if (local_argv[x] && strlen(local_argv[x])) {
|
if (!switch_strlen_zero(local_argv[x])) {
|
||||||
SWITCH_GLOBAL_dirs.log_dir = (char *) malloc(strlen(local_argv[x]) + 1);
|
SWITCH_GLOBAL_dirs.log_dir = (char *) malloc(strlen(local_argv[x]) + 1);
|
||||||
if (!SWITCH_GLOBAL_dirs.log_dir) {
|
if (!SWITCH_GLOBAL_dirs.log_dir) {
|
||||||
fprintf(stderr, "Allocation error\n");
|
fprintf(stderr, "Allocation error\n");
|
||||||
@ -692,7 +692,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
if (local_argv[x] && !strcmp(local_argv[x], "-run")) {
|
if (local_argv[x] && !strcmp(local_argv[x], "-run")) {
|
||||||
x++;
|
x++;
|
||||||
if (local_argv[x] && strlen(local_argv[x])) {
|
if (!switch_strlen_zero(local_argv[x])) {
|
||||||
SWITCH_GLOBAL_dirs.run_dir = (char *) malloc(strlen(local_argv[x]) + 1);
|
SWITCH_GLOBAL_dirs.run_dir = (char *) malloc(strlen(local_argv[x]) + 1);
|
||||||
if (!SWITCH_GLOBAL_dirs.run_dir) {
|
if (!SWITCH_GLOBAL_dirs.run_dir) {
|
||||||
fprintf(stderr, "Allocation error\n");
|
fprintf(stderr, "Allocation error\n");
|
||||||
@ -709,7 +709,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
if (local_argv[x] && !strcmp(local_argv[x], "-db")) {
|
if (local_argv[x] && !strcmp(local_argv[x], "-db")) {
|
||||||
x++;
|
x++;
|
||||||
if (local_argv[x] && strlen(local_argv[x])) {
|
if (!switch_strlen_zero(local_argv[x])) {
|
||||||
SWITCH_GLOBAL_dirs.db_dir = (char *) malloc(strlen(local_argv[x]) + 1);
|
SWITCH_GLOBAL_dirs.db_dir = (char *) malloc(strlen(local_argv[x]) + 1);
|
||||||
if (!SWITCH_GLOBAL_dirs.db_dir) {
|
if (!SWITCH_GLOBAL_dirs.db_dir) {
|
||||||
fprintf(stderr, "Allocation error\n");
|
fprintf(stderr, "Allocation error\n");
|
||||||
@ -726,7 +726,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
if (local_argv[x] && !strcmp(local_argv[x], "-scripts")) {
|
if (local_argv[x] && !strcmp(local_argv[x], "-scripts")) {
|
||||||
x++;
|
x++;
|
||||||
if (local_argv[x] && strlen(local_argv[x])) {
|
if (!switch_strlen_zero(local_argv[x])) {
|
||||||
SWITCH_GLOBAL_dirs.script_dir = (char *) malloc(strlen(local_argv[x]) + 1);
|
SWITCH_GLOBAL_dirs.script_dir = (char *) malloc(strlen(local_argv[x]) + 1);
|
||||||
if (!SWITCH_GLOBAL_dirs.script_dir) {
|
if (!SWITCH_GLOBAL_dirs.script_dir) {
|
||||||
fprintf(stderr, "Allocation error\n");
|
fprintf(stderr, "Allocation error\n");
|
||||||
@ -742,7 +742,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
if (local_argv[x] && !strcmp(local_argv[x], "-htdocs")) {
|
if (local_argv[x] && !strcmp(local_argv[x], "-htdocs")) {
|
||||||
x++;
|
x++;
|
||||||
if (local_argv[x] && strlen(local_argv[x])) {
|
if (!switch_strlen_zero(local_argv[x])) {
|
||||||
SWITCH_GLOBAL_dirs.htdocs_dir = (char *) malloc(strlen(local_argv[x]) + 1);
|
SWITCH_GLOBAL_dirs.htdocs_dir = (char *) malloc(strlen(local_argv[x]) + 1);
|
||||||
if (!SWITCH_GLOBAL_dirs.htdocs_dir) {
|
if (!SWITCH_GLOBAL_dirs.htdocs_dir) {
|
||||||
fprintf(stderr, "Allocation error\n");
|
fprintf(stderr, "Allocation error\n");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user