369:71f9c1288f3e | 370:843dc511c877 |
---|---|
25 #include "pid.h" | 25 #include "pid.h" |
26 #include "futil.h" | 26 #include "futil.h" |
27 #include "xutil.h" | 27 #include "xutil.h" |
28 | 28 |
29 int debug = FALSE; | 29 int debug = FALSE; |
30 static char *mypath; | |
31 sys_config Config; /* System configuration */ | 30 sys_config Config; /* System configuration */ |
32 | 31 |
33 #define MY_ENCODING "utf-8" | 32 #define MY_ENCODING "utf-8" |
34 | 33 |
35 const char TEMPSTATE[3][8] = { "OK", "MISSING", "ERROR" }; | 34 const char TEMPSTATE[3][8] = { "OK", "MISSING", "ERROR" }; |
142 int do_wrconfig(void); | 141 int do_wrconfig(void); |
143 int do_wrconfig(void) | 142 int do_wrconfig(void) |
144 { | 143 { |
145 int rc = 0; | 144 int rc = 0; |
146 FILE *fp; | 145 FILE *fp; |
146 char *mypath = NULL; | |
147 xmlTextWriterPtr writer; | 147 xmlTextWriterPtr writer; |
148 xmlBufferPtr buf; | 148 xmlBufferPtr buf; |
149 units_list *tmp3; | 149 units_list *tmp3; |
150 profiles_list *tmp4; | 150 profiles_list *tmp4; |
151 prof_step *tmp5; | 151 prof_step *tmp5; |
914 if (debug) | 914 if (debug) |
915 fprintf(stdout, "Writing %s\n", mypath); | 915 fprintf(stdout, "Writing %s\n", mypath); |
916 | 916 |
917 if ((fp = fopen(mypath, "w")) == NULL) { | 917 if ((fp = fopen(mypath, "w")) == NULL) { |
918 syslog(LOG_NOTICE, "could not rewrite %s", mypath); | 918 syslog(LOG_NOTICE, "could not rewrite %s", mypath); |
919 return 1; | 919 free(mypath); |
920 } | 920 return 1; |
921 } | |
922 free(mypath); | |
921 | 923 |
922 fprintf(fp, "%s", (const char *) buf->content); | 924 fprintf(fp, "%s", (const char *) buf->content); |
923 fclose(fp); | 925 fclose(fp); |
924 xmlBufferFree(buf); | 926 xmlBufferFree(buf); |
925 | 927 |
1908 | 1910 |
1909 | 1911 |
1910 int rdconfig(void) | 1912 int rdconfig(void) |
1911 { | 1913 { |
1912 int rc = 0, ival; | 1914 int rc = 0, ival; |
1915 char *mypath; | |
1913 xmlDocPtr doc; | 1916 xmlDocPtr doc; |
1914 xmlNodePtr cur; | 1917 xmlNodePtr cur; |
1915 xmlChar *key; | 1918 xmlChar *key; |
1916 | 1919 |
1917 killconfig(); | 1920 killconfig(); |