Commit 7b7e86c9 authored by Cyrill Gorcunov's avatar Cyrill Gorcunov Committed by Pavel Emelyanov

files: Print error if fcntl failed

Signed-off-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 112b2fe5
......@@ -451,15 +451,22 @@ int open_reg_by_id(u32 id)
#define SETFL_MASK (O_APPEND | O_NONBLOCK | O_NDELAY | O_DIRECT | O_NOATIME)
int set_fd_flags(int fd, int flags)
{
int old;
int ret;
old = fcntl(fd, F_GETFL, 0);
if (old < 0)
return old;
ret = fcntl(fd, F_GETFL, 0);
if (ret < 0)
goto err;
flags = (SETFL_MASK & flags) | (ret & ~SETFL_MASK);
flags = (SETFL_MASK & flags) | (old & ~SETFL_MASK);
ret = fcntl(fd, F_SETFL, flags);
if (ret < 0)
goto err;
return 0;
return fcntl(fd, F_SETFL, flags);
err:
pr_perror("fcntl call on fd %d (flags %x) failed", fd, flags);
return -1;
}
static void transport_name_gen(struct sockaddr_un *addr, int *len,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment