requested to merge SuibianP/gnome-control-center:bugfix/sharing-panel-segfault into master
getlogin() can fail for several reasons as detailed in the man page, and
the current behaviour is a segmentation fault when it fails with
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.