projects
/
mirror
/
dsa-puppet.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
f3a2c21
)
Use sysconfig.get_config_var(SIZEOF_TIME_T) since that is what we actually care about
author
Tollef Fog Heen
<tfheen@err.no>
Thu, 12 May 2016 14:00:18 +0000
(16:00 +0200)
committer
Tollef Fog Heen
<tfheen@err.no>
Thu, 12 May 2016 14:00:18 +0000
(16:00 +0200)
modules/porterbox/files/mail-big-homedirs
patch
|
blob
|
history
diff --git
a/modules/porterbox/files/mail-big-homedirs
b/modules/porterbox/files/mail-big-homedirs
index
73370e3
..
b4c3663
100755
(executable)
--- a/
modules/porterbox/files/mail-big-homedirs
+++ b/
modules/porterbox/files/mail-big-homedirs
@@
-38,6
+38,7
@@
import pwd
import subprocess
import struct
import time
import subprocess
import struct
import time
+import sysconfig
import StringIO
# avoid base64 encoding for utf-8
import StringIO
# avoid base64 encoding for utf-8
@@
-123,14
+124,14
@@
class LastlogTimes(dict):
def __init__(self):
record_size_32 = struct.calcsize(self.LASTLOG_STRUCT_32)
record_size_64 = struct.calcsize(self.LASTLOG_STRUCT_64)
def __init__(self):
record_size_32 = struct.calcsize(self.LASTLOG_STRUCT_32)
record_size_64 = struct.calcsize(self.LASTLOG_STRUCT_64)
- if
platform.architecture()[0] == "32bit":
+ if
sysconfig.get_config_var('SIZEOF_TIME_T') == 4
self.LASTLOG_STRUCT = self.LASTLOG_STRUCT_32
record_size = record_size_32
self.LASTLOG_STRUCT = self.LASTLOG_STRUCT_32
record_size = record_size_32
- elif
platform.architecture()[0] == "64bit"
:
+ elif
sysconfig.get_config_var('SIZEOF_TIME_T') == 8
:
self.LASTLOG_STRUCT = self.LASTLOG_STRUCT_64
record_size = record_size_64
else:
self.LASTLOG_STRUCT = self.LASTLOG_STRUCT_64
record_size = record_size_64
else:
- raise RuntimeError('Unknown architecture,
cannot interpret platform.architecture()[0] value (%d)' % platform.architecture()[0]
)
+ raise RuntimeError('Unknown architecture,
sizeof time_t is weird (%d)' % (sysconfig.get_config_var('SIZEOF_TIME_T'),)
)
with open('/var/log/lastlog', 'r') as fp:
uid = -1 # there is one record per uid in lastlog
for record in iter(lambda: fp.read(record_size), ''):
with open('/var/log/lastlog', 'r') as fp:
uid = -1 # there is one record per uid in lastlog
for record in iter(lambda: fp.read(record_size), ''):