Skip to content

Commit

Permalink
tree-wide: s/steal_fd/move_fd/g
Browse files Browse the repository at this point in the history
Suggested-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
  • Loading branch information
Christian Brauner committed Apr 10, 2019
1 parent 8a102e4 commit 426b377
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 14 deletions.
14 changes: 7 additions & 7 deletions src/lxc/commands.c
Expand Up @@ -245,15 +245,15 @@ static int lxc_cmd_send(const char *name, struct lxc_cmd_rr *cmd,
return -1;

if (cmd->req.datalen <= 0)
return steal_fd(client_fd);
return move_fd(client_fd);

errno = EMSGSIZE;
ret = lxc_send_nointr(client_fd, (void *)cmd->req.data,
cmd->req.datalen, MSG_NOSIGNAL);
if (ret < 0 || ret != (ssize_t)cmd->req.datalen)
return -1;

return steal_fd(client_fd);
return move_fd(client_fd);
}

/*
Expand Down Expand Up @@ -304,7 +304,7 @@ static int lxc_cmd(const char *name, struct lxc_cmd_rr *cmd, int *stopped,
*stopped = 1;

if (stay_connected && ret > 0)
cmd->rsp.ret = steal_fd(client_fd);
cmd->rsp.ret = move_fd(client_fd);

return ret;
}
Expand Down Expand Up @@ -866,7 +866,7 @@ int lxc_cmd_add_state_client(const char *name, const char *lxcpath,
return state;
}

*state_client_fd = steal_fd(clientfd);
*state_client_fd = move_fd(clientfd);
TRACE("Added state client %d to state client list", *state_client_fd);
return MAX_STATE;
}
Expand Down Expand Up @@ -1184,7 +1184,7 @@ static int lxc_cmd_accept(int fd, uint32_t events, void *data,
return ret;
}

steal_fd(connection);
move_fd(connection);
return ret;
}

Expand Down Expand Up @@ -1214,7 +1214,7 @@ int lxc_cmd_init(const char *name, const char *lxcpath, const char *suffix)
}

TRACE("Created abstract unix socket \"%s\"", &path[1]);
return steal_fd(fd);
return move_fd(fd);
}

int lxc_cmd_mainloop_add(const char *name, struct lxc_epoll_descr *descr,
Expand All @@ -1229,6 +1229,6 @@ int lxc_cmd_mainloop_add(const char *name, struct lxc_epoll_descr *descr,
return ret;
}

steal_fd(fd);
move_fd(fd);
return ret;
}
7 changes: 0 additions & 7 deletions src/lxc/macro.h
Expand Up @@ -407,11 +407,4 @@ enum {
__internal_fd__; \
})

#define steal_fd(fd) \
({ \
int _fd_ = (fd); \
(fd) = -EBADF; \
_fd_; \
})

#endif /* __LXC_MACRO_H */

0 comments on commit 426b377

Please sign in to comment.