Constify maximum socket name length

This commit is contained in:
Marc André Tanner 2018-05-15 13:57:27 +02:00
parent 35b3f61015
commit 0681dc8daf
1 changed files with 2 additions and 2 deletions

View File

@ -282,7 +282,7 @@ static bool create_socket_dir(struct sockaddr_un *sockaddr) {
if (socketfd == -1)
return false;
size_t maxlen = sizeof(sockaddr->sun_path);
const size_t maxlen = sizeof(sockaddr->sun_path);
uid_t uid = getuid();
struct passwd *pw = getpwuid(uid);
@ -352,7 +352,7 @@ static bool create_socket_dir(struct sockaddr_un *sockaddr) {
}
static bool set_socket_name(struct sockaddr_un *sockaddr, const char *name) {
size_t maxlen = sizeof(sockaddr->sun_path);
const size_t maxlen = sizeof(sockaddr->sun_path);
if (name[0] == '/') {
if (strlen(name) >= maxlen) {
errno = ENAMETOOLONG;