summaryrefslogtreecommitdiffstats
path: root/recipes
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 /recipes
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 'recipes')
-rwxr-xr-xrecipes/clone.sh4
1 files changed, 2 insertions, 2 deletions
diff --git a/recipes/clone.sh b/recipes/clone.sh
index e3fc11cf..d2b9d99d 100755
--- a/recipes/clone.sh
+++ b/recipes/clone.sh
@@ -9,7 +9,7 @@ hostname="$5"
dd if="$preimage" of="$newimage"
guestfish -a "$newimage" -m "$root" <<EOF
-write-file /etc/resolv.conf "nameserver $nameserver" 0
-write-file /etc/HOSTNAME "$hostname" 0
+write /etc/resolv.conf "nameserver $nameserver"
+write /etc/HOSTNAME "$hostname"
sync
EOF