Commit Graph

14 Commits

Author SHA1 Message Date
Matthew Booth
04ea1375c5 Update FSF address. 2011-11-08 14:43:07 +00:00
Richard W.M. Jones
9ff9941836 daemon: Don't use ../src path to include generator_protocol.h
This file is already hard-linked into the current directory, so
the relative path is not required.
2010-11-03 13:15:19 +00:00
Richard Jones
42f59b28f1 daemon: Fix read-file so it fails gracefully for large files (RHBZ#589039).
Pengzhen Cao noticed that read-file would fail for files
larger than the protocol size; this is *not* the bug.  However
it would also lose protocol synchronization after this.

The reason was that functions which return RBufferOut in the
generator must not 'touch' the *size_r parameter along error
return paths.

I fixed read-file and initrd-cat, and I checked that pread was
doing the right thing.

This also adds regression tests for read-file with various categories
of large file.
2010-05-07 15:27:29 +01:00
Richard Jones
e9c3711310 daemon: Don't need to prefix error messages with the command name.
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:..)
2010-02-12 16:49:00 +00:00
Richard Jones
e4fbe3e2cd New API call: initrd-cat to list a file from an initrd. 2010-02-09 12:26:22 +00:00
Richard Jones
688bdc1a06 daemon: Missing #includes revealed by cross-compiling. 2009-11-20 10:36:21 +00:00
Jim Meyering
84fc760439 generator.ml: use new "Pathname" designation
Nearly every file-related function in daemons/*.c is affected:
Remove this pair of statements from each affected do_* function:
-  NEED_ROOT (return -1);
-  ABS_PATH (dir, return -1);
and change the type of the corresponding parameter to "const char *".
* src/generator.ml: Emit NEED_ROOT just once, even when there are two or
more Pathname args.
2009-08-13 14:45:34 +02:00
Jim Meyering
6bda071b5c update all NEED_ROOT uses
run this command:
  git grep -l -w NEED_ROOT|xargs perl -pi -e \
    's/(NEED_ROOT) \((.*?)\)/$1 (return $2)/'
2009-08-13 14:45:34 +02:00
Jim Meyering
0dd6c8c844 update all uses of ABS_PATH
run this command:
  git grep -l -w ABS_PATH|xargs perl -pi -e \
    's/(?:ABS_PATH)( \(.*?,) (.*?)\)/ABS_PATH$1 return $2)/'
2009-08-13 14:45:34 +02:00
Richard Jones
0f2e9c84e9 Replace shell_quote function with %Q and %R printf specifiers.
%Q => simple shell quoted string
%R => path will be prefixed by /sysroot

eg. snprintf (cmd, sizeof cmd, "cat %R", path); system (cmd);
2009-07-28 10:57:57 +01:00
Richard Jones
78029b529a Make /sysroot path configurable.
Currently /sysroot is hard-coded throughout the daemon code.

This patch turns the path into a variable so that we can change
it in future, for example to allow standalone mode to be implemented.

This patch was tested by running all the C API tests successfully.
2009-07-18 10:43:52 +01:00
Jim Meyering
a7b73d4a1e remove trailing blanks 2009-07-03 17:04:21 +02:00
Richard W.M. Jones
3e2d925717 All instances of 'pclose' now check for return value != 0.
We are generally interested that the subcommand ran without
error, ie. had exit status of 0.  'pclose' returns the exit
status, so we now check that pclose (fp) != 0.
2009-07-01 17:13:39 +01:00
Richard W.M. Jones
4dff42aa13 Add 'initrd-list' command to list contents of initrd images.
Add 'initrd-list' command to list the files inside (new-style)
initrd images.  Update virt-inspector to use this instead of
the less efficient download/unpack locally method.
2009-06-29 15:16:40 +01:00