mirror of
https://github.com/yrutschle/sslh.git
synced 2025-06-14 22:32:13 +03:00
clean up inline define
This commit is contained in:
parent
0fe9bd5a95
commit
c0cc45975c
13
common.c
13
common.c
@ -986,6 +986,11 @@ void drop_privileges(const char* user_name, const char* chroot_path)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef O_NOFOLLOW
|
||||||
|
#define O_NOFOLLOW 0
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Writes my PID */
|
/* Writes my PID */
|
||||||
void write_pid_file(const char* pidfile)
|
void write_pid_file(const char* pidfile)
|
||||||
{
|
{
|
||||||
@ -1001,12 +1006,8 @@ void write_pid_file(const char* pidfile)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Open file with O_NOFOLLOW to prevent symlink attacks */
|
/* Open file with O_NOFOLLOW to prevent symlink attacks (Similar to CVE-2020-28935) */
|
||||||
fd = open(pidfile, O_WRONLY | O_CREAT | O_TRUNC
|
fd = open(pidfile, O_WRONLY | O_CREAT | O_TRUNC | O_NOFOLLOW ,0644);
|
||||||
#ifdef O_NOFOLLOW
|
|
||||||
| O_NOFOLLOW
|
|
||||||
#endif
|
|
||||||
,0644);
|
|
||||||
|
|
||||||
if (fd == -1) {
|
if (fd == -1) {
|
||||||
print_message(msg_system_error, "write_pid_file: %s: %s\n", pidfile, strerror(errno));
|
print_message(msg_system_error, "write_pid_file: %s: %s\n", pidfile, strerror(errno));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user