summaryrefslogtreecommitdiffstats
path: root/fish/edit.c
diff options
context:
space:
mode:
authorRichard Jones <rjones@redhat.com>2010-05-18 21:51:05 +0100
committerRichard Jones <rjones@redhat.com>2010-05-20 10:30:12 +0100
commit3920ad95f6b2db8fbf20aa26692877a09070cb04 (patch)
treeeb3ffe5779f720c96a33506d1b50807c430ca977 /fish/edit.c
parentbda6cf75f259992bcba23c3c4c2339c50552f491 (diff)
downloadlibguestfs-3920ad95f6b2db8fbf20aa26692877a09070cb04.tar.gz
libguestfs-3920ad95f6b2db8fbf20aa26692877a09070cb04.tar.xz
libguestfs-3920ad95f6b2db8fbf20aa26692877a09070cb04.zip
New API: write for creating files with fixed content (RHBZ#501889).
The guestfs_write call can be used to create small files with arbitrary 8 bit content, including \0 bytes. This replaces and deprecates write-file, which cannot be modified to use BufferIn because of an unfortunate choice in the ABI: the size parameter to write-file, if zero, means that the daemon tries to calculate the length of the buffer using strlen. However this fails if we pass a zero-length buffer using BufferIn because then the daemon tries to do strlen on a (really) zero length buffer, not even containing a terminating \0 character, thus segfaulting.
Diffstat (limited to 'fish/edit.c')
-rw-r--r--fish/edit.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fish/edit.c b/fish/edit.c
index 3fc41fb1..a010057d 100644
--- a/fish/edit.c
+++ b/fish/edit.c
@@ -156,7 +156,7 @@ do_edit (const char *cmd, int argc, char *argv[])
}
/* Write new content. */
- if (guestfs_write_file (g, argv[0], content_new, size) == -1) {
+ if (guestfs_write (g, argv[0], content_new, size) == -1) {
free (content);
free (content_new);
return -1;