/*
* virerror.c: error handling and reporting code for libvirt
*
- * Copyright (C) 2006, 2008-2012 Red Hat, Inc.
+ * Copyright (C) 2006, 2008-2013 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
} else {
va_list ap;
va_start(ap, fmt);
- virVasprintf(&str, fmt, ap);
+ ignore_value(virVasprintf(&str, fmt, ap));
va_end(ap);
}
/*
* virutil.h: common, generic utility functions
*
- * Copyright (C) 2010-2012 Red Hat, Inc.
+ * Copyright (C) 2010-2013 Red Hat, Inc.
* Copyright (C) 2006, 2007 Binary Karma
* Copyright (C) 2006 Shuveb Hussain
*
int virParseVersionString(const char *str, unsigned long *version,
bool allowMissing);
int virAsprintf(char **strp, const char *fmt, ...)
- ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_FMT_PRINTF(2, 3);
+ ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_FMT_PRINTF(2, 3)
+ ATTRIBUTE_RETURN_CHECK;
int virVasprintf(char **strp, const char *fmt, va_list list)
- ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_FMT_PRINTF(2, 0);
+ ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_FMT_PRINTF(2, 0)
+ ATTRIBUTE_RETURN_CHECK;
char *virStrncpy(char *dest, const char *src, size_t n, size_t destbytes)
ATTRIBUTE_RETURN_CHECK;
char *virStrcpy(char *dest, const char *src, size_t destbytes)
virDevicePCIAddress PCIAddr;
PCIAddr = dev->data.hostdev->source.subsys.u.pci;
- virAsprintf(&target, "PCI device: %.4x:%.2x:%.2x", PCIAddr.domain,
- PCIAddr.bus, PCIAddr.slot);
-
- if (target == NULL) {
+ if (virAsprintf(&target, "PCI device: %.4x:%.2x:%.2x",
+ PCIAddr.domain, PCIAddr.bus, PCIAddr.slot) < 0) {
virReportOOMError();
goto cleanup;
}
{
char *leasefile;
- virAsprintf(&leasefile, "/var/lib/libvirt/dnsmasq/%s.leases",
- netname);
-
+ ignore_value(virAsprintf(&leasefile, "/var/lib/libvirt/dnsmasq/%s.leases",
+ netname));
return leasefile;
}
/*
* virsh-domain.c: Commands to manage domain
*
- * Copyright (C) 2005, 2007-2012 Red Hat, Inc.
+ * Copyright (C) 2005, 2007-2013 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
}
/* Get all possible devices */
- virAsprintf(&xpath, "/domain/devices/%s", node->name);
- if (!xpath) {
+ if (virAsprintf(&xpath, "/domain/devices/%s", node->name) < 0) {
virReportOOMError();
goto cleanup;
}