Skip to content
Snippets Groups Projects
Commit ecd31ef5 authored by Dmitry E. Oboukhov's avatar Dmitry E. Oboukhov
Browse files

Merge branch 'stable'

Conflicts:
	src/lua/bsdsocket.lua
	test/box/bsdsocket.test
parents a24e36e1 72b0ab6f
No related branches found
No related tags found
No related merge requests found
......@@ -817,7 +817,7 @@ local function getaddrinfo(host, port, timeout, opts)
if opts.type ~= nil then
local itype = get_ivalue(internal.SO_TYPE, opts.type)
if itype == nil then
self._errno = boxerrno.EINVAL
boxerrno(boxerrno.EINVAL)
return nil
end
ga_opts.type = itype
......@@ -826,7 +826,7 @@ local function getaddrinfo(host, port, timeout, opts)
if opts.family ~= nil then
local ifamily = get_ivalue(internal.DOMAIN, opts.family)
if ifamily == nil then
self._errno = boxerrno.EINVAL
boxerrno(boxerrno.EINVAL)
return nil
end
ga_opts.family = ifamily
......@@ -835,7 +835,7 @@ local function getaddrinfo(host, port, timeout, opts)
if opts.protocol ~= nil then
local p = ffi.C.getprotobyname(opts.protocol)
if p == nil then
self._errno = boxerrno(boxerrno.EINVAL)
boxerrno(boxerrno.EINVAL)
return nil
end
ga_opts.protocol = p.p_proto
......@@ -845,13 +845,12 @@ local function getaddrinfo(host, port, timeout, opts)
ga_opts.flags =
get_iflags(internal.AI_FLAGS, opts.flags)
if ga_opts.flags == nil then
self._errno = boxerrno()
boxerrno(boxerrno.EINVAL)
return nil
end
end
end
return internal.getaddrinfo(host, port, timeout, ga_opts)
end
......
......@@ -1480,3 +1480,20 @@ fio.stat(path) == nil
- - true
- Invalid argument
...
-- wrong options for getaddrinfo
socket.getaddrinfo('host', 'port', { type = 'WRONG' }) == nil and errno() == errno.EINVAL
---
- true
...
socket.getaddrinfo('host', 'port', { family = 'WRONG' }) == nil and errno() == errno.EINVAL
---
- true
...
socket.getaddrinfo('host', 'port', { protocol = 'WRONG' }) == nil and errno() == errno.EINVAL
---
- true
...
socket.getaddrinfo('host', 'port', { flags = 'WRONG' }) == nil and errno() == errno.EINVAL
---
- true
...
......@@ -499,3 +499,10 @@ s:close()
fio.stat(path) == nil
{ socket.tcp_connect('abrakadabra#123') == nil, errno.strerror() }
-- wrong options for getaddrinfo
socket.getaddrinfo('host', 'port', { type = 'WRONG' }) == nil and errno() == errno.EINVAL
socket.getaddrinfo('host', 'port', { family = 'WRONG' }) == nil and errno() == errno.EINVAL
socket.getaddrinfo('host', 'port', { protocol = 'WRONG' }) == nil and errno() == errno.EINVAL
socket.getaddrinfo('host', 'port', { flags = 'WRONG' }) == nil and errno() == errno.EINVAL
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment