pulse-server: use sizeof() instead of hard-coding

Use `sizeof("/pid")` instead of hard-coding 5
in the condition.
This commit is contained in:
Barnabás Pőcze 2021-07-25 02:20:38 +02:00
parent 627ef37a77
commit b6405b761f

View file

@ -193,7 +193,7 @@ int create_pid_file(void) {
if ((res = get_runtime_dir(pid_file, sizeof(pid_file), "pulse")) < 0)
return res;
if (strlen(pid_file) > PATH_MAX - 5) {
if (strlen(pid_file) > PATH_MAX - sizeof("/pid")) {
pw_log_error(NAME": path too long: %s/pid", pid_file);
return -ENAMETOOLONG;
}