-/* $OpenBSD: control.c,v 1.105 2021/04/27 15:34:18 claudio Exp $ */
+/* $OpenBSD: control.c,v 1.106 2022/02/04 12:01:12 claudio Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
int
control_check(char *path)
{
- struct sockaddr_un sun;
+ struct sockaddr_un sa_un;
int fd;
- bzero(&sun, sizeof(sun));
- sun.sun_family = AF_UNIX;
- strlcpy(sun.sun_path, path, sizeof(sun.sun_path));
+ bzero(&sa_un, sizeof(sa_un));
+ sa_un.sun_family = AF_UNIX;
+ strlcpy(sa_un.sun_path, path, sizeof(sa_un.sun_path));
if ((fd = socket(AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0)) == -1) {
log_warn("%s: socket", __func__);
return (-1);
}
- if (connect(fd, (struct sockaddr *)&sun, sizeof(sun)) == 0) {
+ if (connect(fd, (struct sockaddr *)&sa_un, sizeof(sa_un)) == 0) {
log_warnx("control socket %s already in use", path);
close(fd);
return (-1);
int
control_init(int restricted, char *path)
{
- struct sockaddr_un sun;
+ struct sockaddr_un sa_un;
int fd;
mode_t old_umask, mode;
return (-1);
}
- bzero(&sun, sizeof(sun));
- sun.sun_family = AF_UNIX;
- if (strlcpy(sun.sun_path, path, sizeof(sun.sun_path)) >=
- sizeof(sun.sun_path)) {
+ bzero(&sa_un, sizeof(sa_un));
+ sa_un.sun_family = AF_UNIX;
+ if (strlcpy(sa_un.sun_path, path, sizeof(sa_un.sun_path)) >=
+ sizeof(sa_un.sun_path)) {
log_warn("control_init: socket name too long");
close(fd);
return (-1);
mode = S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP;
}
- if (bind(fd, (struct sockaddr *)&sun, sizeof(sun)) == -1) {
+ if (bind(fd, (struct sockaddr *)&sa_un, sizeof(sa_un)) == -1) {
log_warn("control_init: bind: %s", path);
close(fd);
umask(old_umask);
{
int connfd;
socklen_t len;
- struct sockaddr_un sun;
+ struct sockaddr_un sa_un;
struct ctl_conn *ctl_conn;
- len = sizeof(sun);
+ len = sizeof(sa_un);
if ((connfd = accept4(listenfd,
- (struct sockaddr *)&sun, &len,
+ (struct sockaddr *)&sa_un, &len,
SOCK_NONBLOCK | SOCK_CLOEXEC)) == -1) {
if (errno == ENFILE || errno == EMFILE) {
pauseaccept = getmonotime();