138 initGenericErrorDefaultFunc(&fnc); |
138 initGenericErrorDefaultFunc(&fnc); |
139 sys_init(); |
139 sys_init(); |
140 ctx = dav_context_new(); |
140 ctx = dav_context_new(); |
141 int cfgret = load_config(ctx) || load_sync_config(); |
141 int cfgret = load_config(ctx) || load_sync_config(); |
142 |
142 |
|
143 // ignore sigpipe to make sure the program doesn't exit |
|
144 // if stdout will be closed (for example by using dav-sync ... | head) |
|
145 struct sigaction act; |
|
146 ZERO(&act, sizeof(struct sigaction)); |
|
147 act.sa_handler = SIG_IGN; |
|
148 sigaction(SIGPIPE, &act, NULL); |
|
149 |
|
150 // prepare signal handler thread |
143 pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; |
151 pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; |
144 pthread_mutex_lock(&mutex); |
152 pthread_mutex_lock(&mutex); |
145 pthread_t tid; |
153 pthread_t tid; |
146 |
154 |
147 if(!strcmp(cmd, "check") || !strcmp(cmd, "check-config")) { |
155 if(!strcmp(cmd, "check") || !strcmp(cmd, "check-config")) { |