util: make spdk_parse_ip_addr return -EINVAL instead -1
Change-Id: Idcdaeb5603c5fbe369884ced52e569cc3149be39 Signed-off-by: Pawel Wodkowski <pawelx.wodkowski@intel.com> Reviewed-on: https://review.gerrithub.io/429228 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
parent
0c2a320bcd
commit
7818939c6d
@ -168,7 +168,7 @@ size_t spdk_strlen_pad(const void *str, size_t size, int pad);
|
|||||||
* \param port Will point to the start of the port within ip. The string will be
|
* \param port Will point to the start of the port within ip. The string will be
|
||||||
* null terminated.
|
* null terminated.
|
||||||
*
|
*
|
||||||
* \return 0 on success. -1 on failure.
|
* \return 0 on success. -EINVAL on failure.
|
||||||
*/
|
*/
|
||||||
int spdk_parse_ip_addr(char *ip, char **host, char **port);
|
int spdk_parse_ip_addr(char *ip, char **host, char **port);
|
||||||
|
|
||||||
|
@ -257,7 +257,7 @@ spdk_parse_ip_addr(char *ip, char **host, char **port)
|
|||||||
char *p;
|
char *p;
|
||||||
|
|
||||||
if (ip == NULL) {
|
if (ip == NULL) {
|
||||||
return -1;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
*host = NULL;
|
*host = NULL;
|
||||||
@ -267,7 +267,7 @@ spdk_parse_ip_addr(char *ip, char **host, char **port)
|
|||||||
/* IPv6 */
|
/* IPv6 */
|
||||||
p = strchr(ip, ']');
|
p = strchr(ip, ']');
|
||||||
if (p == NULL) {
|
if (p == NULL) {
|
||||||
return -1;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
*host = &ip[1];
|
*host = &ip[1];
|
||||||
*p = '\0';
|
*p = '\0';
|
||||||
@ -276,7 +276,7 @@ spdk_parse_ip_addr(char *ip, char **host, char **port)
|
|||||||
if (*p == '\0') {
|
if (*p == '\0') {
|
||||||
return 0;
|
return 0;
|
||||||
} else if (*p != ':') {
|
} else if (*p != ':') {
|
||||||
return -1;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
p++;
|
p++;
|
||||||
|
Loading…
Reference in New Issue
Block a user