Skip to content
Snippets Groups Projects
Commit cc91fd1e authored by Daniel Salzman's avatar Daniel Salzman
Browse files

libknot/probe: use fchmod(777) on Linux only (doesn't work on BSD*)

parent a58f6f19
No related branches found
No related tags found
No related merge requests found
......@@ -123,6 +123,13 @@ int knot_probe_set_consumer(knot_probe_t *probe, const char *dir, uint16_t idx)
probe->consumer = true;
#if defined(__linux__)
if (fchmod(probe->fd, S_IRWXU | S_IRWXG | S_IRWXO) != 0) {
close(probe->fd);
return knot_map_errno();
}
#endif
(void)unlink(probe->path.sun_path);
ret = bind(probe->fd, (const struct sockaddr *)(&probe->path),
......@@ -131,11 +138,6 @@ int knot_probe_set_consumer(knot_probe_t *probe, const char *dir, uint16_t idx)
return knot_map_errno();
}
if (fchmod(probe->fd, S_IRWXU | S_IRWXG | S_IRWXO) != 0) {
close(probe->fd);
return knot_map_errno();
}
return KNOT_EOK;
}
......
......@@ -61,6 +61,8 @@ int knot_probe_set_producer(knot_probe_t *probe, const char *dir, uint16_t idx);
/*!
* \brief Initializes one probe consumer.
*
* \note The socket permissions are set to 777 on Linux!
*
* \param probe Probe context.
* \param dir Unix socket directory.
* \param idx Probe ID (counted from 1).
......
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