tree-wide: add a single version of "static const int one = 1"
All over the place we define local variables for the various sockopts that take a bool-like "int" value. Sometimes they are const, sometimes static, sometimes both, sometimes neither. Let's clean this up, introduce a common const variable "const_int_one" (as well as one matching "const_int_zero") and use it everywhere, all acorss the codebase.
This commit is contained in:
@@ -455,7 +455,6 @@ static int create_socket(char **ret) {
|
||||
_cleanup_free_ char *path = NULL;
|
||||
union sockaddr_union sa = {};
|
||||
_cleanup_close_ int fd = -1;
|
||||
static const int one = 1;
|
||||
int salen;
|
||||
|
||||
assert(ret);
|
||||
@@ -476,7 +475,7 @@ static int create_socket(char **ret) {
|
||||
return -errno;
|
||||
}
|
||||
|
||||
if (setsockopt(fd, SOL_SOCKET, SO_PASSCRED, &one, sizeof(one)) < 0)
|
||||
if (setsockopt(fd, SOL_SOCKET, SO_PASSCRED, &const_int_one, sizeof(const_int_one)) < 0)
|
||||
return -errno;
|
||||
|
||||
*ret = TAKE_PTR(path);
|
||||
|
||||
Reference in New Issue
Block a user