DUZES Florian wrote: > # BUGS > Unfortunately, it is often rather easy to fool getlogin(). > Sometimes it does not work at all, because some program messed up > the utmp file. Often, it gives only the first 8 characters of the > login name. The user currently logged in on the controlling > terminal of our program need not be the user who started it. > Avoid getlogin() for security-related purposes.
The getlogin() function depends on certain things in the environment (owners of ttys and such). I won't discuss whether this is a "bug" or not. But certainly there are common environments and less common environments. We have a unit test that works in the common environments. The fact that it can fail in less common environments (containers, jails, etc.) is expected. If you run the tests in such an environment, you will have to exclude that test (via gnulib option '--avoid=getlogin-tests') or ignore the test failure. Bruno
