summaryrefslogtreecommitdiffstats
path: root/tools
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 /tools
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 'tools')
-rwxr-xr-xtools/make-test-img.sh12
1 files changed, 6 insertions, 6 deletions
diff --git a/tools/make-test-img.sh b/tools/make-test-img.sh
index 9752f1dc..fddd8a2d 100755
--- a/tools/make-test-img.sh
+++ b/tools/make-test-img.sh
@@ -68,12 +68,12 @@ mkdir /boot/grub
touch /boot/grub/grub.conf
# Test files.
-write-file /etc/test1 "abcdefg" 0
-write-file /etc/test2 "" 0
-write-file /bin/test1 "abcdefg" 0
-write-file /bin/test2 "zxcvbnm" 0
-write-file /bin/test3 "1234567" 0
-write-file /bin/test4 "" 0
+write /etc/test1 "abcdefg"
+write /etc/test2 ""
+write /bin/test1 "abcdefg"
+write /bin/test2 "zxcvbnm"
+write /bin/test3 "1234567"
+write /bin/test4 ""
ln-s /bin/test1 /bin/test5
mkfifo 0777 /bin/test6
mknod 0777 10 10 /bin/test7