diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/leap/base/config.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/leap/base/config.py b/src/leap/base/config.py index e235e5c3..7021cb0f 100644 --- a/src/leap/base/config.py +++ b/src/leap/base/config.py @@ -333,7 +333,14 @@ def validate_ip(ip_str): def get_username(): - return os.getlogin() + try: + return os.getlogin() + except OSError as e: + if e.message == "[Errno 22] Invalid argument": + import pwd + return pwd.getpwuid(os.getuid())[0] + else: + raise OSError(e.message) def get_groupname(): |