Skip to content

Commit 358d3aa

Browse files
committed
getlogin fails on some Linux
1 parent 0e0d6d0 commit 358d3aa

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Packages/cdat_info/Lib/cdat_info.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import subprocess
2-
2+
import pwd
33
import version
44
Version = version.__describe__
55
ping_checked = False
@@ -192,7 +192,8 @@ def submitPing(source, action, source_version=None):
192192
data['source_version'] = source_version
193193
data['action'] = action
194194
data['sleep'] = cdat_info.sleep
195-
data['hashed_username'] = hashlib.sha1(os.getlogin()).hexdigest()
195+
login = pwd.getpwuid(os.geteuid())[0]
196+
data['hashed_username'] = hashlib.sha1(login).hexdigest()
196197
urllib2.urlopen(
197198
'http://uv-cdat.llnl.gov/UVCDATUsage/log/add/',
198199
urllib.urlencode(data))

0 commit comments

Comments
 (0)