--- motion-20050826-051002/conf.c 2005-08-21 23:50:49.000000000 +0200
+++ motion-20050825-101655-httpd/conf.c 2005-08-25 18:22:44.000000000 +0200
@@ -1250,7 +1250,7 @@ static struct context **conf_process(str
/* conf_print is used to write out the config file(s) motion.conf and any thread
* config files. The function is called when using http remote control.
*/
-void conf_print(struct context **cnt)
+void conf_print(struct context **cnt, int threadnr)
{
const char *retval;
char *val;
@@ -1258,6 +1258,10 @@ void conf_print(struct context **cnt)
FILE *conffile;
for (thread=0; cnt[thread]; thread++) {
+ /* If threadnr is not 0 , just write the conf file for threadnr and end */
+ if (threadnr != 0)
+ thread = threadnr;
+
motion_log(LOG_INFO, 1, "Writing config file to %s",cnt[thread]->conf_filename);
conffile=myfopen(cnt[thread]->conf_filename, "w");
if (!conffile)
@@ -1299,6 +1303,9 @@ void conf_print(struct context **cnt)
fprintf(conffile, "\n");
fclose(conffile);
conffile=NULL;
+ /* If threadnr is not 0 then only config file for threadnr have to be written and exit */
+ if (threadnr != 0)
+ break;
}
}
--- motion-20050826-051002/conf.h 2005-08-21 21:25:28.000000000 +0200
+++ motion-20050825-101655-httpd/conf.h 2005-08-25 18:18:03.000000000 +0200
@@ -143,7 +143,7 @@ extern config_param config_params[];
struct context **conf_load (struct context **);
struct context **conf_cmdparse(struct context **, const char *, const char *);
const char *config_type(config_param *);
-void conf_print (struct context **);
+void conf_print (struct context **, int);
void malloc_strings (struct context *);
char *mystrdup(const char *);
char *mystrcpy(char *, const char *);
--- motion-20050826-051002/webhttpd.c 2005-08-25 07:04:08.000000000 +0200
+++ motion-20050825-101655-httpd/webhttpd.c 2005-08-25 18:17:27.000000000 +0200
@@ -696,7 +696,7 @@ static int config(char *pointer, char *r
send_template(client_socket, res);
send_template_end_client(client_socket);
} else {
- conf_print(cnt);
+ conf_print(cnt, thread);
send_template_ini_client_raw(client_socket);
sprintf(res,"Thread %d write\nDone\n", thread);
send_template_raw(client_socket, res);
@@ -713,7 +713,7 @@ static int config(char *pointer, char *r
pointer=pointer+8;
length_uri=length_uri-8;
if (length_uri==0) {
- conf_print(cnt);
+ conf_print(cnt, thread);
if (cnt[0]->conf.control_html_output) {
send_template_ini_client(client_socket, ini_template);
sprintf(res,"Thread %d write done !
\n"