On Fri, Jun 06, 2008 at 05:01:20PM +0200, Jim Meyering wrote:
"Richard W.M. Jones" <rjones(a)redhat.com> wrote:
> Attached is an updated patch. The changes are:
> - updated to latest CVS
> - run make check / syntax-check
> - remove virsh subcommand (as per Dan's suggestion - see below)
> - some more things that Dan pointed out - see below
...
> Index: src/xend_internal.c
> ===================================================================
...
> + data.path = path;
> + data.ok = 0;
> +
> + if (xend_parse_sexp_blockdevs (domain->conn, root,
> + priv->xendConfigVersion,
> + check_path, &data) == -1)
> + return -1;
> +
> + if (!data.ok) {
> + virXendError (domain->conn, VIR_ERR_INVALID_ARG,
> + _("invalid path"));
> + return -1;
> + }
> +
> + /* The path is correct, now try to open it and get its size. */
> + fd = open (path, O_RDONLY);
> + if (fd == -1 || fstat (fd, &statbuf) == -1) {
> + virXendError (domain->conn, VIR_ERR_SYSTEM_ERROR, strerror (errno));
> + goto done;
> + }
> +
> + /* Seek and read. */
> + /* NB. Because we configure with AC_SYS_LARGEFILE, off_t should
> + * be 64 bits on all platforms.
> + */
> + if (lseek (fd, offset, SEEK_SET) == (off_t) -1 ||
> + saferead (fd, buffer, size) == (ssize_t) -1) {
> + virXendError (domain->conn, VIR_ERR_SYSTEM_ERROR, strerror (errno));
> + goto done;
> + }
Hi Rich,
Sorry it took so long.
This all looks fine.
The only suggestion I can make is to include the "path"
in the three diagnostics above. I imagine it might otherwise
be hard to understand what the diagnostic is talking about otherwise.
Suggested patch attached.
It seems a little bit perverse to have to put gettext around
"%s: %s" but that's what make syntax-check wants.
Rich.
--
Richard Jones, Emerging Technologies, Red Hat
http://et.redhat.com/~rjones
virt-top is 'top' for virtual machines. Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.
http://et.redhat.com/~rjones/virt-top