Jim Meyering
2009-Aug-07 18:07 UTC
[Libguestfs] [PATCH] daemon/file.c: remove duplicate absolute-path check
minor clean-up:>From cac2ce53aec6d3aaca83e4bbc3551d452c29c0b2 Mon Sep 17 00:00:00 2001From: 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. --- daemon/file.c | 1 - 1 files changed, 0 insertions(+), 1 deletions(-) diff --git a/daemon/file.c b/daemon/file.c index 63d8dd2..cd477e5 100644 --- a/daemon/file.c +++ b/daemon/file.c @@ -392,7 +392,6 @@ do_file (char *path) int len; NEED_ROOT_OR_IS_DEVICE (path, NULL); - ABS_PATH (path, NULL); if (strncmp (path, "/dev/", 5) == 0) buf = (char *) path; -- 1.6.4.161.gc0b1
Richard W.M. Jones
2009-Aug-08 10:22 UTC
[Libguestfs] [PATCH] daemon/file.c: remove duplicate absolute-path check
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
Seemingly Similar Threads
- [PATCH 0/23] factor and const-correctness
- [PATCH] ssh-agent: Add support to load additional certificates
- [LLVMdev] Working on getting MingW32/native tools-only source build up
- [PATCH v2 2/2] v2v: -i vmx: Enhance VMX support with ability to use ‘-it ssh’ transport.
- [PATCH 3/4] v2v: copy virtio drivers without guestfs handle leak