Fix bluewave

This commit is contained in:
Andrew Pamment 2018-06-20 19:31:35 +10:00
parent 57a5ac98c8
commit c341df6738

View File

@ -316,6 +316,10 @@ void bwave_create_packet() {
int tot_areas = 0;
int totmsgs = 0;
int ret;
char **args;
int arg_count;
char *cmd;
pid_t pid;
for (i=0;i<conf.mail_conference_count;i++) {
for (j=0;j<conf.mail_conferences[i]->mail_area_count;j++) {
@ -532,8 +536,26 @@ void bwave_create_packet() {
dup2(bbs_stdin, STDIN_FILENO);
}
ret = system(buffer);
args = (char **)malloc(sizeof (char *));
arg_count = 0;
args[arg_count] = strtok(buffer, " ");
while (args[arg_count] != NULL) {
arg_count++;
args = (char **)realloc(args, sizeof(char *) * (arg_count + 1));
args[arg_count] = strtok(NULL, " ");
}
cmd = strdup(args[0]);
pid = fork();
if (pid == 0) {
execvp(cmd, args);
exit(0);
} else if (pid > 0) {
waitpid(pid, &ret, 0);
} else {
ret = -1;
}
free(cmd);
free(args);
if (sshBBS) {
dup2(stout, STDOUT_FILENO);
@ -783,6 +805,7 @@ void bwave_upload_reply() {
int stin;
int sterr;
sqlite3 *db;
int ret;
sqlite3_stmt *res;
int rc;
char *csql = "CREATE TABLE IF NOT EXISTS email ("
@ -795,7 +818,11 @@ void bwave_upload_reply() {
"seen INTEGER);";
char *isql = "INSERT INTO email (sender, recipient, subject, body, date, seen) VALUES(?, ?, ?, ?, ?, 0)";
char *err_msg = 0;
char **args;
int arg_count;
char *cmd;
pid_t pid;
int ret;
msg_count = 0;
snprintf(buffer, 1024, "%s/node%d", conf.bbs_path, mynode);
@ -845,8 +872,26 @@ void bwave_upload_reply() {
dup2(bbs_stderr, STDERR_FILENO);
dup2(bbs_stdin, STDIN_FILENO);
}
system(buffer);
args = (char **)malloc(sizeof (char *));
arg_count = 0;
args[arg_count] = strtok(buffer, " ");
while (args[arg_count] != NULL) {
arg_count++;
args = (char **)realloc(args, sizeof(char *) * (arg_count + 1));
args[arg_count] = strtok(NULL, " ");
}
cmd = strdup(args[0]);
pid = fork();
if (pid == 0) {
execvp(cmd, args);
exit(0);
} else if (pid > 0) {
waitpid(pid, &ret, 0);
} else {
ret = -1;
}
free(cmd);
free(args);
if (sshBBS) {
dup2(stout, STDOUT_FILENO);