diff options
author | hut <hut@lavabit.com> | 2010-02-13 00:54:27 +0100 |
---|---|---|
committer | hut <hut@lavabit.com> | 2010-02-13 00:54:32 +0100 |
commit | 87db0130f83b071845258a073c62460ccdf6efe5 (patch) | |
tree | 7a28bc06041b84ae09516e456c37ed6d21ebaff6 | |
parent | 336cc468e37cb41ce9c1838c7d93138cf48e0916 (diff) | |
download | ranger-87db0130f83b071845258a073c62460ccdf6efe5.tar.gz |
fixed #46: wrong username displayed when using su
-rw-r--r-- | TODO | 2 | ||||
-rw-r--r-- | ranger/gui/widgets/titlebar.py | 7 |
2 files changed, 6 insertions, 3 deletions
diff --git a/TODO b/TODO index 3366ca4e..9a5a4675 100644 --- a/TODO +++ b/TODO @@ -56,7 +56,7 @@ Bugs (X) #31 10/01/06 ^C breaks cd-after-exit by stopping sourced shell script ( ) #40 10/01/17 freeze with unavailable sshfs (X) #41 10/01/17 capital file extensions are not recognized - ( ) #46 10/01/19 old username displayed after using su + (X) #46 10/01/19 old username displayed after using su (X) #49 10/01/19 fix unit tests :'( ( ) #52 10/01/23 special characters in tab completion (X) #54 10/01/23 max_dirsize_for_autopreview not working diff --git a/ranger/gui/widgets/titlebar.py b/ranger/gui/widgets/titlebar.py index 43729947..7c164ae9 100644 --- a/ranger/gui/widgets/titlebar.py +++ b/ranger/gui/widgets/titlebar.py @@ -53,9 +53,12 @@ class TitleBar(Widget): self.result = bar.combine() def _get_left_part(self, bar): - import socket, os + import socket, os, pwd - username = os.getenv('USER') + try: + username = pwd.getpwuid(os.geteuid()).pw_name + except: + username = "???" if username == 'root': clr = 'bad' else: |