[Libvirt-cim] [PATCH] When saving out the infostore, clear any previous data

Dan Smith danms at us.ibm.com
Wed Aug 6 22:17:44 UTC 2008


KR> -        lseek(ctx->fd, 0, SEEK_SET);
KR> +        close(ctx->fd);
KR> +        ctx->fd = open(ctx->filename, O_RDWR|O_TRUNC, 0600);
KR> +        if (ctx->fd < 0) {
KR> +                CU_DEBUG("Unable to open `%s': %m", ctx->filename);
KR> +                goto out;
KR> +        }

Why not just leave the lseek() in place, and then call an ftruncate() on
the file descriptor?  That saves us from adding all the infrastructure
for saving the filename, etc.

It's my fault for not calling for the truncate in the original
code... Good catch!

-- 
Dan Smith
IBM Linux Technology Center
Open Hypervisor Team
email: danms at us.ibm.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 188 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvirt-cim/attachments/20080806/c3053b9b/attachment.sig>


More information about the Libvirt-cim mailing list