1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 21:08:12 +00:00

LibC: strcpy a socket address at compile time

This way, we'd get compile-time errors if the address was too long for the buffer.
This commit is contained in:
Sergey Bugaev 2020-08-25 20:03:14 +03:00 committed by Andreas Kling
parent 852454746e
commit 0817ef563e

View file

@ -82,9 +82,10 @@ static int connect_to_lookup_server()
return -1;
}
sockaddr_un address;
address.sun_family = AF_LOCAL;
strlcpy(address.sun_path, "/tmp/portal/lookup", sizeof(address.sun_path));
sockaddr_un address {
AF_LOCAL,
"/tmp/portal/lookup"
};
if (connect(fd, (const sockaddr*)&address, sizeof(address)) < 0) {
perror("connect_to_lookup_server");