summaryrefslogtreecommitdiffstats
path: root/daemon/proto.c
Commit message (Collapse)AuthorAgeFilesLines
* Fix FileIn cmds losing synch if both ends send cancel messages (RHBZ#576879).Richard Jones2010-05-131-3/+3
| | | | | | | | | | | | | | | | | | | | | | | During a FileIn command (eg. upload, tar-in) if both sides experience errors, then both sides could send cancel messages, the result being lost synchronization. The reason for the lost synch was because the daemon was ignoring this case and sending an error message back which the library side (which had cancelled) was not expecting. Fix this by checking in the daemon for the case where the library also cancels during daemon cancellation, and not sending an error messages. This also includes an enhanced regression test which checks for this case. This extends the original fix in commit 5922d7084d6b43f0a1a15b664c7082dfeaf584d0. More details can be found here: https://bugzilla.redhat.com/show_bug.cgi?id=576879#c5
* Code cleanups related to RHBZ#580246.Richard Jones2010-04-081-4/+13
| | | | | | | | | | | | | | 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.
* Fix the error message when reply body is too large (RHBZ#509597).Richard Jones2010-03-271-1/+1
|
* daemon error handling: Define a new function reply_with_perror_errno.Richard Jones2009-12-071-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | 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: 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.
* daemon/Win32: Use xdr_u_int for PortableXDR compatibility.Richard Jones2009-11-251-7/+7
| | | | PortableXDR didn't support xdr_uint32_t. xdr_u_int is the same type.
* daemon/Win32: Use gnulib modules for first porting to Win32.Richard Jones2009-11-201-0/+1
|
* maint: use EXIT_SUCCESS and EXIT_FAILURE, not 0 and 1 to exitJim Meyering2009-11-201-15/+15
| | | | | | | | | | | | | | | Convert all uses automatically, via these two commands: git grep -l '\<exit *(1)' \ | grep -vEf .x-sc_prohibit_magic_number_exit \ | xargs --no-run-if-empty \ perl -pi -e 's/\b(exit ?)\(1\)/$1(EXIT_FAILURE)/' git grep -l '\<exit *(0)' \ | grep -vEf .x-sc_prohibit_magic_number_exit \ | xargs --no-run-if-empty \ perl -pi -e 's/\b(exit ?)\(0\)/$1(EXIT_SUCCESS)/' * .x-sc_prohibit_magic_number_exit: New file. Edit (RWMJ): Don't change Java code.
* avoid use of all ctype macrosJim Meyering2009-09-241-2/+2
| | | | | | | | | | | | | | | | | | | | * cfg.mk (disable_temporarily): Don't disable sc_avoid_ctype_macros. * fish/tilde.c: Remove unnecessary inclusion of ctype.h. * bootstrap: Add gnulib's c-ctype module to the list. * daemon/m4/gnulib-cache.m4: Likewise. * daemon/ext2.c: Include "c-ctype.h", not <ctype.h>. Use c_isspace, etc, rather than isspace. * daemon/guestfsd.c: Likewise. * daemon/lvm.c: Likewise. * daemon/proto.c: Likewise. * fish/fish.c: Likewise. * fish/tilde.c: Likewise. * src/generator.ml: Likewise. * src/guestfs.c: Likewise. * examples/to-xml.c: Likewise. * examples/Makefile.am (to_xml_CPPFLAGS): Add -I$(top_srcdir)/gnulib/lib so inclusion of "c-ctype.h" works. (to_xml_CPPFLAGS): Rename from to_xml_CFLAGS.
* Fix code which looked for leaked FDs between each command.Richard Jones2009-09-171-4/+4
| | | | | | This code was not checking the return value from system() so it failed if uncommented. Add ignore_value() around the call to system. However, leave the code still disabled.
* Daemon: fix handling of errors from xread and xwrite.Richard Jones2009-09-171-7/+11
| | | | | | If xread or xwrite returns -1, that indicates an error and we should exit. Note that xread/xwrite has already printed the error message.
* Fix verbose packet dumping functions.Richard Jones2009-09-171-3/+3
| | | | | | | | | | Add the configure parameter --enable-packet-dump so that this code can be enabled without editing the source. This code is normally commented out, because it is too verbose unless you happen to be debugging the underlying protocol. Because it is normally commented out, I found it had bit-rotted slightly. This commit also fixes the obvious problems.
* 'len' should be an unsigned 32 bit int.Richard Jones2009-09-171-1/+1
| | | | | This only happened to work by accident before because 'unsigned len' happens to be 32 bit on all platforms we support.
* daemon: diagnose socket write failureJim Meyering2009-08-201-5/+9
| | | | | | | | | * daemon/proto.c (send_chunk): Don't ignore socket-write error. * daemon/proto.c (send_file_end): Return "int", not void, so we can propagate send_chunk failure to caller. * daemon/daemon.h (send_file_end): Update prototype. * daemon/tar.c (do_tar_out, do_tgz_out): Update uses of send_file_end. * daemon/upload.c (do_download): Likewise.
* guestfsd: don't ignore failed write-to-socketJim Meyering2009-08-171-1/+1
| | | | | * daemon/proto.c (reply): Fix typo that would cause us to ignore failed write-to-socket.
* Convert all TABs-as-indentation to spaces.Jim Meyering2009-08-031-24/+24
| | | | | | | | | | | Do it by running this command: [exempted files are matched via .x-sc_TAB_in_indentation] git ls-files \ | pcregrep -vf .x-sc_TAB_in_indentation \ | xargs pcregrep -l '^ *\t' \ | xargs perl -MText::Tabs -ni -le \ '$m=/^( *\t[ \t]*)(.*)/; print $m ? expand($1) . $2 : $_'
* Don't die if reply message is oversized (RHBZ#509597).Richard Jones2009-07-051-2/+7
|
* remove trailing blanksJim Meyering2009-07-031-1/+1
|
* Add list of function_names to the daemon.Richard W.M. Jones2009-07-021-2/+4
| | | | | Messages which include the proc_nr can now also include the name of the actual function being called.
* In verbose mode, daemon will display the time elapsed for each command.Richard W.M. Jones2009-07-021-0/+19
|
* Carefully check return values from xwrite.Richard Jones2009-04-261-4/+18
|
* Fix file descriptor leak in daemon.Richard Jones2009-04-201-0/+8
|
* Implement upload and download commands.Richard Jones2009-04-201-24/+226
|
* Separate out the high-level API actions.Richard Jones2009-04-181-1/+1
| | | | | | - Split out the high-level API actions so that they are in a separate file, and use the defined guestfs C API, instead of fiddling around with internal structures.
* Added test suite.Richard Jones2009-04-111-4/+4
|
* pvs/vgs/lvs commands working now.Richard Jones2009-04-071-1/+1
|
* Parses return values and returned errors properly.Richard Jones2009-04-031-2/+1
|
* Makes a series of non-trivial calls.Richard Jones2009-04-031-3/+197
|
* Daemon and library are mostly talking to each other now.Richard Jones2009-04-031-0/+59