summaryrefslogtreecommitdiffstats
path: root/fish
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
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')
-rw-r--r--fish/edit.c2
-rw-r--r--fish/fish.c2
-rw-r--r--fish/guestfish.pod4
3 files changed, 4 insertions, 4 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;
diff --git a/fish/fish.c b/fish/fish.c
index 06ce960d..a32ed4d0 100644
--- a/fish/fish.c
+++ b/fish/fish.c
@@ -1093,7 +1093,7 @@ display_builtin_command (const char *cmd)
" This is used to edit a file.\n"
"\n"
" It is the equivalent of (and is implemented by)\n"
- " running \"cat\", editing locally, and then \"write-file\".\n"
+ " running \"cat\", editing locally, and then \"write\".\n"
"\n"
" Normally it uses $EDITOR, but if you use the aliases\n"
" \"vi\" or \"emacs\" you will get those editors.\n"
diff --git a/fish/guestfish.pod b/fish/guestfish.pod
index 7260caf0..274f1d41 100644
--- a/fish/guestfish.pod
+++ b/fish/guestfish.pod
@@ -41,7 +41,7 @@ Create a new C</etc/motd> file in a guest:
add disk.img
run
mount /dev/vg_guest/lv_root /
- write_file /etc/motd "Welcome, new users" 0
+ write /etc/motd "Welcome, new users"
_EOF_
List the LVM logical volumes in a guest:
@@ -57,7 +57,7 @@ Update C</etc/resolv.conf> in a guest:
guestfish \
add disk.img : run : mount /dev/vg_guest/lv_root / : \
- write-file /etc/resolv.conf "nameserver 1.2.3.4" 0
+ write /etc/resolv.conf "nameserver 1.2.3.4"
Edit C</boot/grub/grub.conf> interactively: