goto label; \
} \
} while (0)
+# define virCheckNonEmptyStringArgGoto(argname, label) \
+ do { \
+ if (argname == NULL) { \
+ virReportInvalidNonNullArg(argname); \
+ goto label; \
+ } \
+ if (*argname == '\0') { \
+ virReportInvalidEmptyStringArg(argname); \
+ goto label; \
+ } \
+ } while (0)
# define virCheckPositiveArgGoto(argname, label) \
do { \
if (argname <= 0) { \
conn = dom->conn;
virCheckReadOnlyGoto(conn->flags, error);
- virCheckNonNullArgGoto(disk, error);
+ virCheckNonEmptyStringArgGoto(disk, error);
/* Allow size == 0 as an access test. */
if (size > 0)
memset(info, 0, sizeof(*info));
virCheckDomainReturn(domain, -1);
- virCheckNonNullArgGoto(disk, error);
+ virCheckNonEmptyStringArgGoto(disk, error);
virCheckNonNullArgGoto(info, error);
conn = domain->conn;
if (virDomainBlockPeekEnsureACL(dom->conn, vm->def) < 0)
goto cleanup;
- if (!path || path[0] == '\0') {
- virReportError(VIR_ERR_INVALID_ARG,
- "%s", _("NULL or empty path"));
- goto cleanup;
- }
-
/* Check the path belongs to this domain. */
if (!(actual = virDomainDiskPathByName(vm->def, path))) {
virReportError(VIR_ERR_INVALID_ARG,
if (virDomainGetBlockInfoEnsureACL(dom->conn, vm->def) < 0)
goto cleanup;
- if (!path || path[0] == '\0') {
- virReportError(VIR_ERR_INVALID_ARG, "%s", _("NULL or empty path"));
- goto cleanup;
- }
-
/* Technically, we only need a job if we are going to query the
* monitor, which is only for active domains that are using
* non-raw block devices. But it is easier to share code if we
0, 0, \
_("%s in %s must not be NULL"), \
#argname, __FUNCTION__)
+# define virReportInvalidEmptyStringArg(argname) \
+ virRaiseErrorFull(__FILE__, __FUNCTION__, __LINE__, \
+ VIR_FROM_THIS, \
+ VIR_ERR_INVALID_ARG, \
+ VIR_ERR_ERROR, \
+ __FUNCTION__, \
+ #argname, \
+ NULL, \
+ 0, 0, \
+ _("string %s in %s must not be empty"), \
+ #argname, __FUNCTION__)
# define virReportInvalidPositiveArg(argname) \
virRaiseErrorFull(__FILE__, __FUNCTION__, __LINE__, \
VIR_FROM_THIS, \