What is up with fin? Is it really just writing an int 0 in the memory right after some variable present in libc or similar?
extern fin;
if(getpw(0, pwbuf))
goto badpw;
(&fin)[1] = 0;I’m guessing v4 C didn’t have structs yet (v6 C does, but struct members are actually in the global namespace and are basically just sugar for offset and a type cast; member access even worked on literals. That’s why structs from early unix APIs have prefixed member names, like st_mode.
According to the chatbot, the first word of `fin` is the file descriptor, the second its state. "Reset stdin’s flags to a clean state".
Predecessor of