[Libguestfs] [PATCH] daemon/file.c: remove duplicate absolute-path check
Richard W.M. Jones
rjones at redhat.com
Mon Aug 10 08:56:11 UTC 2009
On Mon, Aug 10, 2009 at 10:50:10AM +0200, Jim Meyering wrote:
> Richard W.M. Jones wrote:
> > 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.
>
> Thanks.
> I'm working on this now.
I had a think about the particular case of 'Path' over the weekend,
and I think that would have to turn into two parameters (in the
daemon), ie:
int
do_somecmd (const char *path, const char *sysroot_path)
{
if (something_with (sysroot_path) == -1) {
reply_with_error (path);
The reason is that functions use the original path or the
prefixed path in various places.
Original path for:
- error messages
- syscalls inside CHROOT_IN/CHROOT_OUT brackets
Path prefixed with sysroot for:
- anything outside chroot
Escaped path (%Q / %R) for:
- shell commands (eg. popen, system)
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
More information about the Libguestfs
mailing list