|
@@ -97,20 +97,22 @@ queue_job(struct Job job)
|
|
|
}
|
|
|
|
|
|
int
|
|
|
-listen_and_convert()
|
|
|
+listen_and_convert(int do_fork)
|
|
|
{
|
|
|
int sock, fd;
|
|
|
struct sockaddr_un cli_addr;
|
|
|
unsigned int clilen;
|
|
|
struct Job job;
|
|
|
|
|
|
- pid_t child_pid = fork();
|
|
|
- if (child_pid < 0) {
|
|
|
- err("fork failed");
|
|
|
- } else if (child_pid > 0) {
|
|
|
- usleep(1000000);
|
|
|
- // parent process
|
|
|
- return 1;
|
|
|
+ if (do_fork == 1) {
|
|
|
+ pid_t child_pid = fork();
|
|
|
+ if (child_pid < 0) {
|
|
|
+ err("fork failed");
|
|
|
+ } else if (child_pid > 0) {
|
|
|
+ usleep(1000000);
|
|
|
+ // parent process
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
clilen = sizeof(cli_addr);
|
|
@@ -176,7 +178,7 @@ main(int argc, char *argv[])
|
|
|
|
|
|
if(queue_job(job)) return 0;
|
|
|
|
|
|
- if(listen_and_convert())
|
|
|
+ if(listen_and_convert(1))
|
|
|
queue_job(job);
|
|
|
|
|
|
return 0;
|