diff options
author | Ian Jackson <ian.jackson@eu.citrix.com> | 2011-01-26 11:58:45 +0000 |
---|---|---|
committer | Ian Jackson <ian.jackson@eu.citrix.com> | 2011-01-26 11:58:45 +0000 |
commit | a6998c944c4bbfc13804f20958953cdcd686f762 (patch) | |
tree | 30423e69d850435284976f1e1699aa5f37b271dd /tools/libxl/libxl_utils.c | |
parent | c80ed144feb3bcf697e13204207e6863f0e2b9b0 (diff) | |
download | xen-a6998c944c4bbfc13804f20958953cdcd686f762.tar.gz xen-a6998c944c4bbfc13804f20958953cdcd686f762.tar.bz2 xen-a6998c944c4bbfc13804f20958953cdcd686f762.zip |
libxl: band-aid for functions which return literal "-1"
Many libxl functions erroneously return "-1" on error, rather than
some ERROR_* value.
To deal with this, invent a new ERROR_NONSPECIFIC "-1" which indicates
that "the function which generated this error code is broken".
Fix up the one we care about for forthcoming duplicate domain
detection (libxl_name_to_domid) and the others following the same
pattern nearby; leave the rest for post-4.1.
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Diffstat (limited to 'tools/libxl/libxl_utils.c')
-rw-r--r-- | tools/libxl/libxl_utils.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/tools/libxl/libxl_utils.c b/tools/libxl/libxl_utils.c index 64c884fd77..a44f8af3e4 100644 --- a/tools/libxl/libxl_utils.c +++ b/tools/libxl/libxl_utils.c @@ -93,7 +93,7 @@ int libxl_name_to_domid(libxl_ctx *ctx, const char *name, int i, nb_domains; char *domname; libxl_dominfo *dominfo; - int ret = -1; + int ret = ERROR_INVAL; dominfo = libxl_list_domain(ctx, &nb_domains); if (!dominfo) @@ -142,7 +142,7 @@ int libxl_name_to_cpupoolid(libxl_ctx *ctx, const char *name, int i, nb_pools; char *poolname; libxl_cpupoolinfo *poolinfo; - int ret = -1; + int ret = ERROR_INVAL; poolinfo = libxl_list_cpupool(ctx, &nb_pools); if (!poolinfo) @@ -171,7 +171,7 @@ int libxl_name_to_schedid(libxl_ctx *ctx, const char *name) if (strcmp(name, schedid_name[i].name) == 0) return schedid_name[i].id; - return -1; + return ERROR_INVAL; } char *libxl_schedid_to_name(libxl_ctx *ctx, int schedid) @@ -287,7 +287,7 @@ int libxl_string_to_phystype(libxl_ctx *ctx, char *s, libxl_disk_phystype *physt } else if (!strcmp(s, "tap")) { p = strchr(s, ':'); if (!p) { - rc = -1; + rc = ERROR_INVAL; goto out; } p++; |