/*
- * Copyright (C) 2012 - David Goulet <dgoulet@efficios.com>
- * Copyright (C) 2018 - Jérémie Galarneau <jeremie.galarneau@efficios.com>
+ * Copyright (C) 2012 David Goulet <dgoulet@efficios.com>
+ * Copyright (C) 2018 Jérémie Galarneau <jeremie.galarneau@efficios.com>
*
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License, version 2 only, as
- * published by the Free Software Foundation.
+ * SPDX-License-Identifier: GPL-2.0-only
*
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc., 51
- * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "lttng-sessiond.h"
if (is_root) {
/* lttng health client socket path permissions */
- ret = chown(config.health_unix_sock_path.value, 0,
- utils_get_group_id(config.tracing_group_name.value));
+ gid_t gid;
+
+ ret = utils_get_group_id(config.tracing_group_name.value, true, &gid);
+ if (ret) {
+ /* Default to root group. */
+ gid = 0;
+ }
+
+ ret = chown(config.health_unix_sock_path.value, 0, gid);
if (ret < 0) {
ERR("Unable to set group on %s", config.health_unix_sock_path.value);
PERROR("chown");
revents = LTTNG_POLL_GETEV(&events, i);
pollfd = LTTNG_POLL_GETFD(&events, i);
- if (!revents) {
- /* No activity for this FD (poll implementation). */
- continue;
- }
-
/* Event on the registration socket */
if (pollfd == sock) {
if (revents & LPOLLIN) {
notifiers = zmalloc(sizeof(*notifiers));
if (!notifiers) {
- goto error;
+ goto error_alloc;
}
sem_init(¬ifiers->ready, 0, 0);
return true;
error:
cleanup_health_management_thread(notifiers);
+error_alloc:
return false;
}