mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-08-07 10:20:29 +00:00
remove ugly sizeof(DEV_FD) - 1
This commit is contained in:
parent
a66ccdcf5d
commit
45ee600239
1 changed files with 5 additions and 4 deletions
|
@ -39,6 +39,7 @@
|
||||||
#define KERN_PROC_PATHNAME_FREEBSD 12
|
#define KERN_PROC_PATHNAME_FREEBSD 12
|
||||||
#define KERN_PROC_PATHNAME_NETBSD 5
|
#define KERN_PROC_PATHNAME_NETBSD 5
|
||||||
#define DEV_FD "/dev/fd/"
|
#define DEV_FD "/dev/fd/"
|
||||||
|
#define STRLEN_DEV_FD (sizeof(DEV_FD) - 1)
|
||||||
|
|
||||||
static struct {
|
static struct {
|
||||||
atomic_uint once;
|
atomic_uint once;
|
||||||
|
@ -144,10 +145,10 @@ static inline void InitProgramExecutableNameImpl(void) {
|
||||||
empty string to obviate the TOCTOU problem between loader and binary.
|
empty string to obviate the TOCTOU problem between loader and binary.
|
||||||
*/
|
*/
|
||||||
if ((!IsNetbsd() && !IsOpenbsd() && !IsXnu()) /* any others? */ ||
|
if ((!IsNetbsd() && !IsOpenbsd() && !IsXnu()) /* any others? */ ||
|
||||||
0 != strncmp(DEV_FD, __program_executable_name, sizeof(DEV_FD) - 1) ||
|
0 != strncmp(DEV_FD, __program_executable_name, STRLEN_DEV_FD) ||
|
||||||
!__program_executable_name[sizeof(DEV_FD) - 1] ||
|
!__program_executable_name[STRLEN_DEV_FD] ||
|
||||||
__program_executable_name[sizeof(DEV_FD) - 1] == '.' ||
|
__program_executable_name[STRLEN_DEV_FD] == '.' ||
|
||||||
strchr(__program_executable_name + sizeof(DEV_FD) - 1, '/')) {
|
strchr(__program_executable_name + STRLEN_DEV_FD, '/')) {
|
||||||
goto UseEmpty;
|
goto UseEmpty;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue