mirror of
https://github.com/AuxXxilium/eudev.git
synced 2025-01-12 15:08:55 +07:00
fix a couple of AF_UNIX connect() calls
This commit is contained in:
parent
ba8d3790e8
commit
3338b9595b
@ -160,7 +160,7 @@ int main(int argc, char *argv[]) {
|
||||
sa.un.sun_family = AF_UNIX;
|
||||
strncpy(sa.un.sun_path, "/run/dbus/system_bus_socket", sizeof(sa.un.sun_path));
|
||||
|
||||
if (connect(fd, &sa.sa, offsetof(struct sockaddr_un, sun_path) + 1 + strlen(sa.un.sun_path+1)) < 0) {
|
||||
if (connect(fd, &sa.sa, offsetof(struct sockaddr_un, sun_path) + strlen(sa.un.sun_path)) < 0) {
|
||||
log_error("Failed to connect: %m");
|
||||
goto finish;
|
||||
}
|
||||
|
@ -151,7 +151,7 @@ static int log_open_syslog(void) {
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (connect(syslog_fd, &sa.sa, sizeof(sa)) < 0) {
|
||||
if (connect(syslog_fd, &sa.sa, offsetof(struct sockaddr_un, sun_path) + strlen(sa.un.sun_path)) < 0) {
|
||||
close_nointr_nofail(syslog_fd);
|
||||
|
||||
/* Some legacy syslog systems still use stream
|
||||
@ -163,7 +163,7 @@ static int log_open_syslog(void) {
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (connect(syslog_fd, &sa.sa, sizeof(sa)) < 0) {
|
||||
if (connect(syslog_fd, &sa.sa, offsetof(struct sockaddr_un, sun_path) + strlen(sa.un.sun_path)) < 0) {
|
||||
r = -errno;
|
||||
goto fail;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user