From c6e0a8f5c833dce8be7af45d28f0fb41d8819d73 Mon Sep 17 00:00:00 2001 From: ha7ilm Date: Wed, 2 Dec 2015 15:27:28 +0100 Subject: [PATCH] Fixed build. --- ddcd.cpp | 12 ++++++------ ddcd.h | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/ddcd.cpp b/ddcd.cpp index 2bf89c1..968941f 100644 --- a/ddcd.cpp +++ b/ddcd.cpp @@ -79,7 +79,7 @@ int main(int argc, char* argv[]) {"address", required_argument, 0, 'a' }, {"decimation", required_argument, 0, 'd' }, {"bufsize", required_argument, 0, 'b' }, - {"method", required_argument, 0, 'm' } + {"method", required_argument, 0, 'm' }, {"transition", required_argument, 0, 't' } }; c = getopt_long(argc, argv, "p:a:d:b:", long_options, &option_index); @@ -201,7 +201,7 @@ int main(int argc, char* argv[]) case M_TD: break; case M_FASTDDC: - sprintf(main_subprocess_cmd_buf, subprocess_args_fastddc_1, decimation, tansition_bw); + sprintf(main_subprocess_cmd_buf, subprocess_args_fastddc_1, decimation, transition_bw); close(STDIN_FILENO); // redirect stdin to the stdin of the subprocess main_subprocess_pid = run_subprocess( main_subprocess_cmd_buf, 0, pipe_s2m ); break; @@ -303,8 +303,8 @@ int main(int argc, char* argv[]) pid_t run_subprocess(char* cmd, int* pipe_in, int* pipe_out) { pid_t pid = fork(); - if(p < 0) return 0; //fork failed - if(p==0) + if(pid < 0) return 0; //fork failed + if(pid == 0) { //We're the subprocess if(fcntl(pipe_in[1], F_SETPIPE_SZ, pipe_max_size) == -1) perror("Failed to F_SETPIPE_SZ in run_subprocess()"); @@ -318,8 +318,8 @@ pid_t run_subprocess(char* cmd, int* pipe_in, int* pipe_out) close(pipe_out[0]); dup2(pipe_out[1], STDOUT_FILENO); } - execl("/bin/bash","bash","-c",cmd, 0); - error_exit(MSG_START "run_subprocess failed to execute command") + execl("/bin/bash","bash","-c",cmd, NULL); + error_exit(MSG_START "run_subprocess failed to execute command"); } else return pid; } diff --git a/ddcd.h b/ddcd.h index eea134d..5bdd085 100644 --- a/ddcd.h +++ b/ddcd.h @@ -32,7 +32,7 @@ void error_exit(const char* why); void print_exit(const char* why); void print_client(client_t* client, const char* what); int proc_exists(pid_t pid); -void run_subprocess(char* cmd, int* pipe_in, int* pipe_out); +pid_t run_subprocess(char* cmd, int* pipe_in, int* pipe_out); void maxfd(int* maxfd, int fd); typedef enum ddc_method_e @@ -47,7 +47,7 @@ const char subprocess_cmd_td[] = "csdr " #else "shift_unroll_cc" #endif - " --pipe %d,%d | csdr fir_decimate_cc %d %g" }; + " --pipe %d,%d | csdr fir_decimate_cc %d %g"; const char subprocess_args_fastddc_1[] = "csdr fastddc_fwd_cc %d %g"; const char subprocess_args_fastddc_2[] = "csdr fastddc_inv_cc %d --pipe %d,%d %g";