Does getcwd() ignore the size of the buffer and copy it? – Ubuntu
#include <unistd.h> #include <stdlib.h> #include <stdio.h> int main() { char wd[10]; if(getcwd(wd,BUFSIZ) == NULL){ //BUFSIZ = 8192 perror("getcwd"); exit(1); } printf("wd = %sn",wd); } This C code works well in Ubuntu Linux 20. The size of buffer wd is 10…