[libvirt] main: fix some compilation issues on non-linux platforms
Eric Blake
eblake at redhat.com
Tue Aug 16 17:29:06 UTC 2011
On 08/16/2011 11:19 AM, Stefan Berger wrote:
s/main/maint/ in the subject line.
> This patch fixes *some* compilation issues on non-Linux platforms (cygwin).
>
> Signed-off-by: Stefan Berger <stefanb at linux.vnet.ibm.com>
>
> int
> -pciDeviceNetName(char *device_link_sysfs_path, char **netname)
> +pciDeviceNetName(char *device_link_sysfs_path ATTRIBUTE_UNUSED,
> + char **netname ATTRIBUTE_UNUSED)
This and above are fine.
> {
> pciReportError(VIR_ERR_INTERNAL_ERROR, _("pciDeviceNetName is not "
> "supported on non-linux platforms"));
> diff --git a/src/util/virfile.c b/src/util/virfile.c
> index 0edf058..1158998 100644
> --- a/src/util/virfile.c
> +++ b/src/util/virfile.c
> @@ -44,7 +44,7 @@
>
> int virFileClose(int *fdptr, bool preserve_errno)
> {
> - int saved_errno;
> + int saved_errno = 0;
> int rc = 0;
This is a different kind of warning. It is due to a compiler
false-positive (I'm guessing that you are seeing a warning about
uninitialized use of saved_errno, even though use of that variable is
properly gated so that it is initialized on all paths where it is later
used). But still okay, although I might have split it into a different
patch, and listed the compiler warning that it silences as part of the
commit message.
> +++ b/src/util/virpidfile.c
> @@ -213,6 +213,8 @@ int virPidFileReadPathIfAlive(const char *path,
> #ifdef __linux__
> if (virFileLinkPointsTo(procpath, binpath) == 0)
> *pid = -1;
> +#else
> + (void)binpath;
> #endif
Here, I'd rather mark binpath as ATTRIBUTE_UNUSED than add the #else
preprocessor conditional. That is, ATTRIBUTE_UNUSED means only that the
variable might be unused, not that it can't be used (so used on linux,
unused otherwise qualifies).
ACK with that nit fixed.
--
Eric Blake eblake at redhat.com +1-801-349-2682
Libvirt virtualization library http://libvirt.org
More information about the libvir-list
mailing list