Skip to content

sharing/remote-desktop: handle gracefully when unable to get username

getlogin() can fail for several reasons as detailed in the man page, and the current behaviour is a segmentation fault when it fails with NULL, such as due to an unset loginuid.

  • Check return value for error and act accordingly.
  • Change to getpwuid(getuid())->pw_name, which is less likely to error.
Edited by Hu Jialun

Merge request reports