1
0
Fork 0

Bug fix in mms_billing_shell.c - honour return value of script

This commit is contained in:
bagyenda 2006-02-21 14:36:36 +00:00
parent 05d1910723
commit 7efbee12b7
3 changed files with 8 additions and 4 deletions

View File

@ -33,7 +33,7 @@ static int mms_billingmodule_fini(void *module_data)
return module_data ? fclose(module_data) : -1;
}
static double mms_billmsg(Octstr *from, List *to, unsigned long msg_size, Octstr *vaspid, void *module_data)
static int mms_billmsg(Octstr *from, List *to, unsigned long msg_size, Octstr *vaspid, void *module_data)
{
return 0;
}

View File

@ -47,7 +47,7 @@ typedef struct MmsBillingFuncStruct {
/* Bills a message. Returns >= 0 if billed ok, -1 if message should be rejected,
* -2 on internal (temporary) error.
*/
double (*mms_billmsg)(Octstr *from, List *to, unsigned long msg_size, Octstr *vaspid, void *module_data);
int (*mms_billmsg)(Octstr *from, List *to, unsigned long msg_size, Octstr *vaspid, void *module_data);
int (*mms_billingmodule_fini)(void *module_data);
} MmsBillingFuncStruct;

View File

@ -33,7 +33,7 @@ static int mms_billingmodule_fini(void *module_data)
return 0;
}
static double mms_billmsg(Octstr *from, List *to, unsigned long msg_size, Octstr *vaspid, void *module_data)
static int mms_billmsg(Octstr *from, List *to, unsigned long msg_size, Octstr *vaspid, void *module_data)
{
int i;
@ -43,8 +43,12 @@ static double mms_billmsg(Octstr *from, List *to, unsigned long msg_size, Octstr
Octstr *s;
s = octstr_format("%s '%s' '%s'", octstr_get_cstr(script), octstr_get_cstr(from), octstr_get_cstr(list_get(to, i)));
if (s) {
system(octstr_get_cstr(s));
int ret = system(octstr_get_cstr(s));
octstr_destroy(s);
if (ret < 0)
return -2;
else if (WEXITSTATUS(ret) != 0)
return -1;
}
}
return 0;