forked from external/yambar
modules: add SOCK_CLOEXEC to all socket() calls
This commit is contained in:
parent
3ff1c95208
commit
4bb81e8940
4 changed files with 5 additions and 5 deletions
|
@ -621,7 +621,7 @@ run(struct module *mod)
|
|||
if (!i3_get_socket_address(&addr))
|
||||
return 1;
|
||||
|
||||
int sock = socket(AF_UNIX, SOCK_STREAM, 0);
|
||||
int sock = socket(AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0);
|
||||
if (sock == -1) {
|
||||
LOG_ERRNO("failed to create UNIX socket");
|
||||
return 1;
|
||||
|
|
|
@ -223,7 +223,7 @@ wait_for_socket_create(const struct module *mod)
|
|||
struct stat st;
|
||||
if (stat(m->host, &st) == 0 && S_ISSOCK(st.st_mode)) {
|
||||
|
||||
int s = socket(AF_UNIX, SOCK_STREAM, 0);
|
||||
int s = socket(AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0);
|
||||
|
||||
struct sockaddr_un addr = {.sun_family = AF_UNIX};
|
||||
strncpy(addr.sun_path, m->host, sizeof(addr.sun_path) - 1);
|
||||
|
|
|
@ -167,7 +167,7 @@ nl_pid_value(void)
|
|||
static int
|
||||
netlink_connect_rt(void)
|
||||
{
|
||||
int sock = socket(AF_NETLINK, SOCK_RAW, NETLINK_ROUTE);
|
||||
int sock = socket(AF_NETLINK, SOCK_RAW | SOCK_CLOEXEC, NETLINK_ROUTE);
|
||||
if (sock == -1) {
|
||||
LOG_ERRNO("failed to create netlink socket");
|
||||
return -1;
|
||||
|
@ -191,7 +191,7 @@ netlink_connect_rt(void)
|
|||
static int
|
||||
netlink_connect_genl(void)
|
||||
{
|
||||
int sock = socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC);
|
||||
int sock = socket(AF_NETLINK, SOCK_RAW | SOCK_CLOEXEC, NETLINK_GENERIC);
|
||||
if (sock == -1) {
|
||||
LOG_ERRNO("failed to create netlink socket");
|
||||
return -1;
|
||||
|
|
|
@ -267,7 +267,7 @@ run(struct module *mod)
|
|||
if (!i3_get_socket_address(&addr))
|
||||
return 1;
|
||||
|
||||
int sock = socket(AF_UNIX, SOCK_STREAM, 0);
|
||||
int sock = socket(AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0);
|
||||
if (sock == -1) {
|
||||
LOG_ERRNO("failed to create UNIX socket");
|
||||
return 1;
|
||||
|
|
Loading…
Add table
Reference in a new issue