
anibal at sgi
Mar 4, 2007, 10:14 PM
Post #3 of 5
(554 views)
Permalink
|
|
Re: heartbeat should detect and recover from corrupt CIB
[In reply to]
|
|
On Fri, Mar 02, 2007 at 09:03:19AM +0100, Andrew Beekhof wrote: >coincidentally i already applied something equivalent to the first >part of this patch a couple of days ago - but the second half looks >like a good addition too. There is a missing crm_free(buffer). Updated patch follows. --- lib/crm/common/xml.c~ 2007-01-12 13:57:08.000000000 +1100 +++ lib/crm/common/xml.c 2007-03-05 11:31:17.630665050 +1100 @@ -634,6 +634,11 @@ /* establish the file with correct permissions */ file_output_strm = fopen(filename, "w"); + if(file_output_strm == NULL) { + crm_free(buffer); + cl_perror("Cannot open %s", filename); + return -1; + } fclose(file_output_strm); chmod(filename, cib_mode); @@ -684,7 +689,12 @@ if(res < 0) { cl_perror("Cannot write output to %s",filename); } - fflush(file_output_strm); + if(fflush(file_output_strm) == EOF || fsync(fileno(file_output_strm)) < 0) { + crm_free(buffer); + cl_perror("fflush or fsync error on %s", filename); + fclose(file_output_strm); + return -1; + } } fclose(file_output_strm); crm_free(buffer); Aníbal _______________________________________________________ Linux-HA-Dev: Linux-HA-Dev [at] lists http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev Home Page: http://linux-ha.org/
|