socket-handler.c (9a8f30ec5b58252caeb5b856c353d37df9e4cf4d) socket-handler.c (954be0fbc4acdd0322041c4c86fa08fd33ded594)
1/**
2 * Copyright © 2016 IBM Corporation
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0

--- 328 unchanged lines hidden (view full) ---

337 reallocarray(sh->clients, sh->n_clients, sizeof(*sh->clients));
338 /* NOLINTEND(bugprone-sizeof-expression) */
339 sh->clients[n] = client;
340
341 return POLLER_OK;
342}
343
344static int socket_init(struct handler *handler, struct console *console,
1/**
2 * Copyright © 2016 IBM Corporation
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0

--- 328 unchanged lines hidden (view full) ---

337 reallocarray(sh->clients, sh->n_clients, sizeof(*sh->clients));
338 /* NOLINTEND(bugprone-sizeof-expression) */
339 sh->clients[n] = client;
340
341 return POLLER_OK;
342}
343
344static int socket_init(struct handler *handler, struct console *console,
345 struct config *config)
345 struct config *config __attribute__((unused)))
346{
347 struct socket_handler *sh = to_socket_handler(handler);
348 struct sockaddr_un addr;
349 size_t addrlen;
350 ssize_t len;
351 int rc;
352
353 sh->console = console;
354 sh->clients = NULL;
355 sh->n_clients = 0;
356
357 memset(&addr, 0, sizeof(addr));
358 addr.sun_family = AF_UNIX;
346{
347 struct socket_handler *sh = to_socket_handler(handler);
348 struct sockaddr_un addr;
349 size_t addrlen;
350 ssize_t len;
351 int rc;
352
353 sh->console = console;
354 sh->clients = NULL;
355 sh->n_clients = 0;
356
357 memset(&addr, 0, sizeof(addr));
358 addr.sun_family = AF_UNIX;
359 len = console_socket_path(addr.sun_path,
360 config_get_value(config, "console-id"));
359 len = console_socket_path(addr.sun_path, console->console_id);
361 if (len < 0) {
362 if (errno) {
363 warn("Failed to configure socket: %s", strerror(errno));
364 } else {
365 warn("Socket name length exceeds buffer limits");
366 }
367 return -1;
368 }

--- 64 unchanged lines hidden ---
360 if (len < 0) {
361 if (errno) {
362 warn("Failed to configure socket: %s", strerror(errno));
363 } else {
364 warn("Socket name length exceeds buffer limits");
365 }
366 return -1;
367 }

--- 64 unchanged lines hidden ---