Negative ports don't make sense so use a unsigned integer.
---
src/qemu/qemu_command.c | 3 +--
src/util/viruri.h | 2 +-
2 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index b994940a2..f7858302b 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -809,8 +809,7 @@ qemuBuildNetworkDriveURI(virStorageSourcePtr src,
goto cleanup;
if (src->hosts->transport == VIR_STORAGE_NET_HOST_TRANS_TCP) {
- if (virStrToLong_i(src->hosts->port, NULL, 10, &uri->port) < 0
||
- uri->port < 0) {
+ if (virStrToLong_uip(src->hosts->port, NULL, 10, &uri->port) < 0)
{
virReportError(VIR_ERR_INTERNAL_ERROR,
_("failed to parse port number '%s'"),
src->hosts->port);
diff --git a/src/util/viruri.h b/src/util/viruri.h
index 1e53abb0b..7850c38c2 100644
--- a/src/util/viruri.h
+++ b/src/util/viruri.h
@@ -42,7 +42,7 @@ struct _virURI {
char *scheme; /* the URI scheme */
char *server; /* the server part */
char *user; /* the user part */
- int port; /* the port number */
+ unsigned int port; /* the port number */
char *path; /* the path string */
char *query; /* the query string */
char *fragment; /* the fragment string */
--
2.13.2