summaryrefslogtreecommitdiffstats
path: root/daemon
Commit message (Collapse)AuthorAgeFilesLines
* Code cleanups related to RHBZ#580246.Richard Jones2010-04-084-24/+32
| | | | | | | | | | | | | | | This includes various code cleanups: (a) A regression test for RHBZ#580246. (b) Use write instead of fwrite to write out the tar file. This is just because the error handling of write seems to be better specified and easier to use. (c) Use size_t instead of int for length. (d) Clearer debug messages when in verbose mode. (cherry picked from commit de7ef2a0fdcbcddfd35ecb8ee2804e1ca0968454)
* Fix tar-in command hangs when running out of disk space (RHBZ#580246).Richard Jones2010-04-082-3/+6
| | | | | | | | | | | | | | | | | | | | | The problem was this sequence of events: (1) File transfer goes through OK. (2) pclose returns failure (because 'tar' subprocess failed) (3) We try to cancel the transfer by calling cancel_receive. Step (3) fails because the transfer (as far as the library is concerned) has succeeded, so causing a hang. The more fundamental reason why we see steps (1) and (2) is that 'tar' does NOT fail immediately if there is a write error. Instead it continues reading and discarding the input until the end of the input before giving "Error exit delayed from previous errors". IMHO this is a bug with tar, since an ENOSPC write error should be fatal for tar. (cherry picked from commit 07f4b20ae959069fca41756b0dc103ec5fa99754)
* Check error returns from posix_fallocate (RHBZ#579664).Richard Jones2010-04-081-4/+4
| | | | | | | | | | | | | | | | | | | | | | posix_fallocate has a non-standard way to return error indications. Thus all our calls to posix_fallocate were effectively unchecked. For example: $ guestfish alloc test.img 1P $ echo $? 0 $ ll test.img -rw-rw-r--. 1 rjones rjones 0 2010-04-06 11:02 test.img $ rm test.img With this change, errors are detected and reported properly: $ ./fish/guestfish alloc test.img 1P fallocate: File too large This is a fix for: https://bugzilla.redhat.com/show_bug.cgi?id=579664 (cherry picked from commit 2ade61d1f864c75ce65c358e4ac8a012a897b89a)
* daemon: Set TERM=dumb inside the daemon.Richard Jones2010-03-301-0/+1
| | | | | | | | | | | | | | | Since commit 977edb3185fe8f we have been passing TERM from the library into the appliance (for the benefit of virt-rescue). However this changes the output of parted, which I would argue is a bug in parted: TERM=xterm /sbin/parted -m -- /dev/sda unit b print 2>&1 | hexdump -C 00000000 1b 5b 3f 31 30 33 34 68 42 59 54 3b 0a 2f 64 65 |.[?1034hBYT;./de| Notice the escape-sequence junk before the official "BYT;" header. By setting TERM=dumb we avoid this.
* Fix the error message when reply body is too large (RHBZ#509597).Richard Jones2010-03-271-1/+1
|
* Const-correctness fix.Jim Meyering2010-03-261-1/+1
|
* appliance: Set $PATH instead of hard-coding paths to binaries everywhere.Richard Jones2010-03-2615-68/+88
| | | | | | Change the appliance so PATH includes common directories. Thus we don't need to hard-code paths to binaries (eg. "/sbin/fdisk") everywhere.
* Fix lvresize test on RHEL 5, by fixing guestfs_e2fsck_l.Richard Jones2010-03-241-2/+9
| | | | | | | | | The problem is that mkfs was making an ext2 filesystem, which later we were checking with e4fsck. e4fsck corrects an "error" on the filesystem: /dev/VG/LV: Adding dirhash hint to filesystem. e4fsck returns 1 (errors corrected) which we were interpreting as an error return.
* Use ext4 dev tools on RHEL 5 (RHBZ#576688).Richard Jones2010-03-241-51/+85
|
* New API: guestfs_copy_size to copy a fixed number of bytes.Richard Jones2010-03-231-0/+81
| | | | | | | This is similar to 'guestfs_dd', but it copies just a fixed number of bytes from the source to the destination. It's an error if the source is too short or if the destination is too small.
* New APIs: Query the relationship between LVM objects.Richard Jones2010-03-181-0/+83
| | | | | | | | | These calls allow you to query the relationship between LVM objects, for example, which PVs contain a VG, or which LVs are contained in a VG. See the example / test program 'regressions/test-lvm-mapping.pl' for an example of how to do this from Perl.
* daemon: Add a trim utility function.Richard Jones2010-03-182-0/+24
| | | | | This function trims the whitespace from around a string. It does this in-place, so it can be called for malloc'd strings.
* Tab to space (whitespace fixes only).Richard Jones2010-03-121-1/+1
|
* Distribute .gitignore files.Richard Jones2010-02-151-1/+2
| | | | | These are useful for Debian since they keep the tarball unpacked in git.
* daemon: Don't need to prefix error messages with the command name.Richard Jones2010-02-1241-113/+116
| | | | | | | | | | | | | | | | | | | | The RPC stubs already prefix the command name to error messages. The daemon doesn't have to do this. As a (small) benefit this also makes the daemon slightly smaller. Code in the daemon such as: if (argv[0] == NULL) { reply_with_error ("passed an empty list"); return NULL; } now results in error messages like this: ><fs> command "" libguestfs: error: command: passed an empty list (whereas previously you would have seen ..command: command:..)
* New API call: initrd-cat to list a file from an initrd.Richard Jones2010-02-091-0/+121
|
* Implement 'vgrename' and 'lvrename' APIs.Richard Jones2010-01-281-0/+44
|
* Add 'filesize' call.Richard Jones2010-01-251-0/+18
| | | | | Returns the size of a file. You can already do this with 'stat', but this call is good for scripting.
* Update to latest Gnulib.Richard Jones2010-01-132-2/+7
|
* daemon: Work around udevsettle issue (RHBZ#548121).Richard Jones2009-12-181-21/+9
|
* daemon error handling: Define a new function reply_with_perror_errno.Richard Jones2009-12-072-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | This allows you to save the errno from a previous call and pass it to reply_with_perror. For example, original code: r = some_system_call (); err = errno; do_cleanup (); errno = err; if (r == -1) { reply_with_perror ("failed"); return -1; } can in future be changed to: r = some_system_call (); err = errno; do_cleanup (); if (r == -1) { reply_with_perror_errno (err, "failed"); return -1; }
* daemon error handling: recursive_mkdir shouldn't need to set errno.Richard Jones2009-12-071-5/+11
|
* daemon error handling: Clear errno before calling stub functions.Richard Jones2009-12-041-1/+16
| | | | | | This just ensures that we accurately report errors, even if our error path code doesn't set errno. We won't end up with a bogus errno left over from a previous call.
* Whitespace change.Richard Jones2009-11-271-1/+1
|
* daemon: Move prototypes around to keep functions grouped logically.Richard Jones2009-11-261-3/+3
|
* Fix error handling in 'zero' function.Richard Jones2009-11-261-10/+7
|
* Make realpath call optional, disable it for Windows.Richard Jones2009-11-262-0/+16
|
* build: update gnulib submodule to latestRichard Jones2009-11-261-0/+1
|
* daemon: program_name must be defined for Gnulib error module.Richard Jones2009-11-261-0/+3
|
* daemon/Win32: use gnulib modules connect, socket and symlinkat (for readlinkat).Richard Jones2009-11-264-2/+38
|
* daemon/Win32: provide htonl, htons, ntohl, ntohs functions.Richard Jones2009-11-265-1/+90
| | | | These functions are not available on Windows.
* daemon/Win32: Use Gnulib perror module.Richard Jones2009-11-261-1/+2
|
* daemon: Link guestfs_protocol.[ch] into the daemon directory.Richard Jones2009-11-261-5/+24
| | | | | | | | | | | Instead of doing a recursive call into the src/ directory to build the object files, hard link the source files into the daemon directory and build them separately. See: http://www.redhat.com/archives/libguestfs/2009-November/msg00254.html Thanks to Jim Meyering for noticing a typo in the original version.
* daemon: Typo generator_build -> generator_builtRichard Jones2009-11-261-1/+1
|
* daemon: Indent C macros to reflect nesting level.Richard Jones2009-11-261-5/+5
|
* daemon/Win32: Win32 can't fork message moved to separate function (Jim Meyering)Richard Jones2009-11-261-5/+11
|
* daemon: Fix build on Unix.Richard Jones2009-11-251-1/+3
|
* daemon: Fix sync() call on Unix.Richard Jones2009-11-251-1/+2
|
* daemon/Win32: update commentRichard Jones2009-11-251-1/+1
|
* daemon/Win32: Supply MAX macro for challenged platforms.Richard Jones2009-11-251-0/+4
|
* daemon/Win32: Windows can't daemonize.Richard Jones2009-11-251-0/+5
|
* daemon/Win32: Windows replacement for umask.Richard Jones2009-11-251-0/+8
|
* daemon/Win32: Replace setenv with Win32 equivalent.Richard Jones2009-11-251-0/+7
|
* daemon/Win32: Use xdr_u_int for PortableXDR compatibility.Richard Jones2009-11-252-8/+8
| | | | PortableXDR didn't support xdr_uint32_t. xdr_u_int is the same type.
* daemon/Win32: Don't bother blocking SIGPIPE on Win32.Richard Jones2009-11-251-0/+2
|
* daemon/Win32: Use gnulib getaddrinfo module.Richard Jones2009-11-253-1/+12
|
* daemon/Win32: Implement statvfs using GetDiskFreeSpaceEx.Richard Jones2009-11-254-2/+128
| | | | | | | At the time of writing Gnulib didn't support Win32 for its fsusage API. Therefore this patch uses GetDiskFreeSpaceEx if it's available (on Windows) otherwise falls back to using Gnulib fsusage.
* daemon: Move statvfs code into separate file.Richard Jones2009-11-253-38/+69
| | | | | | This makes no functional change to the code. It just moves the statvfs-related code out of daemon/stat.c into a new file called daemon/statvfs.c.
* daemon: Use gnulib futimens module.Richard Jones2009-11-255-11/+10
| | | | | | | | | Instead of checking for futimens support and falling back (incorrectly in one case) to using futimes, use gnulib's module. However the gnulib module does not yet support Win32, so this change is only really useful on platforms like RHEL 5.
* daemon/Win32: Use gnulib pread module.Richard Jones2009-11-252-0/+3
|