]> git.proxmox.com Git - mirror_corosync.git/commitdiff
logsys: Properly lock flt data before dump
authorJan Friesse <jfriesse@redhat.com>
Mon, 21 Feb 2011 12:23:46 +0000 (13:23 +0100)
committerJan Friesse <jfriesse@redhat.com>
Tue, 22 Feb 2011 09:11:11 +0000 (10:11 +0100)
Data needs to be locked, otherwise resulting fdata file may be
incorrect.

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Steven Dake <sdake@redhat.com>
exec/logsys.c

index cbcfb0c62b59da80256b65d4e9d74eeb8975414a..c6786892977433c0e101f777d1caa5cc6c633be4 100644 (file)
@@ -1617,6 +1617,8 @@ int logsys_log_rec_store (const char *filename)
                return (-1);
        }
 
+       logsys_flt_lock();
+
        this_write_size = write (fd, &flt_data_size, sizeof(uint32_t));
        if (this_write_size != sizeof(unsigned int)) {
                goto error_exit;
@@ -1643,10 +1645,12 @@ int logsys_log_rec_store (const char *filename)
                goto error_exit;
        }
 
+       logsys_flt_unlock();
        close (fd);
        return (0);
 
 error_exit:
+       logsys_flt_unlock();
        close (fd);
        return (-1);
 }