summaryrefslogtreecommitdiffstats
path: root/examples/virt-dhcp-address.c
Commit message (Collapse)AuthorAgeFilesLines
* inspection: Fix calls to case_sensitive_path (RHBZ#858126).Richard W.M. Jones2012-09-281-3/+1
| | | | | | | | | | | | | | | | | | | | | Don't assume that if guestfs_case_sensitive_path returns NULL, that it means the file does not exist. The (previously undefined) behaviour of case_sensitive_path was that a NULL return meant "either the file doesn't exist or some other error". However in commit 973581780d8a006f336684fef6762801402d775d this was changed so that if the last element of the path didn't exist, it was assumed to be a new file and the (non-NULL) path of the new file is returned. This change breaks code (including in libguestfs) which tries to use case_sensitive_path as a dual-purpose call to fix-up a path for Windows and test if the file exists. Such code should be rewritten so that it explicitly tests for file existence after calling case_sensitive_path. I examined all the calls to case_sensitive_path in libguestfs and modified them where necessary.
* Update inspection and example programs to use new hivex* APIs (RHBZ#852394).Richard W.M. Jones2012-08-291-60/+37
| | | | | | | | | | | | | | | | | | | | | | | I tested this by comparing the output of virt-inspector over Windows guests before and after the change, which was identical: $ md5sum `ls -1 /tmp/*.before /tmp/*.after` c292d6629b5a761eccb4a279754399b4 /tmp/Win2003.after c292d6629b5a761eccb4a279754399b4 /tmp/Win2003.before eb1e1ff29208a9ee46e9c100dfec26b2 /tmp/Win2012.after eb1e1ff29208a9ee46e9c100dfec26b2 /tmp/Win2012.before d060a95d7ffe5dce6c4e66feb80c2837 /tmp/Win7x32.after d060a95d7ffe5dce6c4e66feb80c2837 /tmp/Win7x32.before 8914eee70ac4f8a0317659e09e00dcdc /tmp/Win7x32Dynamic.after 8914eee70ac4f8a0317659e09e00dcdc /tmp/Win7x32Dynamic.before a2dcdfc0f9d64054640875aa791889e0 /tmp/Win7x32TwoDisks.after a2dcdfc0f9d64054640875aa791889e0 /tmp/Win7x32TwoDisks.before 5ed49568a5147dce7517c99de41ebf2e /tmp/Win8previewx64.after 5ed49568a5147dce7517c99de41ebf2e /tmp/Win8previewx64.before fdfc7d272b79a665ae3313ae1ae30660 /tmp/WinXP.after fdfc7d272b79a665ae3313ae1ae30660 /tmp/WinXP.before 3c705444be664f1316b21c5d8d3cb0be /tmp/WinXPRecConsole.after 3c705444be664f1316b21c5d8d3cb0be /tmp/WinXPRecConsole.before
* grep: Add optargs to grep API and deprecate fgrep etc.Richard W.M. Jones2012-08-021-1/+3
| | | | | | | | This commit makes grep into an optargs API, with flags for extended, fixed, [case-]insensitive and compressed. At the same time it deprecates: egrep, fgrep, grepi, egrepi, fgrepi, zgrep, zegrep, zfgrep, zgrepi, zegrepi and zfgrepi.
* Check return values of guestfs_inspect_get_{type,distro} (found by Coverity).Richard W.M. Jones2012-03-081-0/+4
| | | | | | | | | Error: NULL_RETURNS: /builddir/build/BUILD/libguestfs-1.16.5/examples/virt-dhcp-address.c:129: var_assigned: Assigning: "guest_distro" = null return value from "guestfs_inspect_get_distro". /builddir/build/BUILD/libguestfs-1.16.5/examples/virt-dhcp-address.c:131: dereference: Dereferencing a pointer that might be null "guest_distro" when calling "__coverity_strcmp". [...] /builddir/build/BUILD/libguestfs-1.16.5/examples/virt-dhcp-address.c:126: var_assigned: Assigning: "guest_type" = null return value from "guestfs_inspect_get_type". /builddir/build/BUILD/libguestfs-1.16.5/examples/virt-dhcp-address.c:128: dereference: Dereferencing a pointer that might be null "guest_type" when calling "__coverity_strcmp".
* New API: inspect-get-windows-current-control-setRichard W.M. Jones2011-04-051-23/+8
| | | | | | | | | | | | | | This returns the actual registry key corresponding to CurrentControlSet (eg. it might be "ControlSet001"). Previously the inspection code was hard-coding ControlSet001. Now we use the correct control set, and also make it available to callers through the API. This commit also updates the virt-dhcp-address example so it uses this new API. virt-inspector displays the current control set when available.
* examples: Add virt-dhcp-address program.Richard W.M. Jones2011-03-311-0/+342
This is like the mythical 'virt-ifconfig'. There is not enough certainty around the right way to be doing this for us to make a full virt tool for this. Therefore the code is just an example.