[Libguestfs] [PATCH] daemon/file.c: remove duplicate absolute-path check

Richard W.M. Jones rjones at redhat.com
Sat Aug 8 10:22:54 UTC 2009


On Fri, Aug 07, 2009 at 08:07:50PM +0200, Jim Meyering wrote:
> minor clean-up:
> 
> >From cac2ce53aec6d3aaca83e4bbc3551d452c29c0b2 Mon Sep 17 00:00:00 2001
> From: Jim Meyering <meyering at redhat.com>
> Date: Fri, 7 Aug 2009 20:07:03 +0200
> Subject: [PATCH] daemon/file.c: remove duplicate absolute-path check
> 
> * daemon/file.c (do_file): Remove redundant use of ABS_PATH.
> It's redundant because the preceding line invokes NEED_ROOT_OR_IS_DEVICE,
> which also invokes ABS_PATH.

Agreed, ACK.

If we had a separate 'Path' type in the generator, then these checks
could be automated.

That is to say, splitting the existing String variant into String .. |
Device .. | Path .. | DeviceOrPath .., where DeviceOrPath is just
needed for the couple of functions that wrongly take a string which
could be a device or a path ('file' being one of these).

Also note that most (all?) paths get rewritten in the non-generated
code to prefix them with the content of the sysroot global variable.
(See: sysroot, sysroot_path and the %R custom printf spec).  This is
particularly error-prone and probably another candidate for
automation.

Rich.

-- 
Richard Jones, Emerging Technologies, Red Hat  http://et.redhat.com/~rjones
New in Fedora 11: Fedora Windows cross-compiler. Compile Windows
programs, test, and build Windows installers. Over 70 libraries supprt'd
http://fedoraproject.org/wiki/MinGW http://www.annexia.org/fedora_mingw




More information about the Libguestfs mailing list