-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Open
Labels
Description
Please use the following bug reporting template to help produce actionable and reproducible issues:
- A brief description
Attempting to use the function to get the login id of the user running the executable returns garbled strings, with a different return value each time. - Expected results
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <unistd.h>
int main(){
size_t len = 10;
char buf[len];
size_t ret = getlogin_r(buf, len);
puts(buf);
return 0;
}should print out my username, with ret set to 0 to indicate success.
- Actual results (with terminal output if applicable)
The value of ret is 2, indicating an error.
Depending on the C compiler used, it outputs garbage strings.
���If compiled with GCC or Clang, it prints out a single "unknown char" box.
If compiled with TCC, it prints out a string the size of one's username, composed of aforementioned boxes and random numbers, letters, and symbols.
- Your Windows build number
14393
- Steps / commands required to reproduce the error
gcc test.c -o test && ./test
- Strace of the failing command
Command doesn't fail in this sense.
- Required packages and commands to install
sudo apt-get install build-essential
yan12125
