From efda4ad0b33d71305f6d6e896e02a3e6054f7b9b Mon Sep 17 00:00:00 2001 From: Vipin K Parashar Date: Fri, 25 Nov 2016 15:37:33 +0530 Subject: [PATCH] utils.py: Fix logic for determining word size Currently list_eth_names() checks architecture width to determine offset for interface array name lookup. This gets broken for ppc64le architecture. Changing this logic to use 'sys.maxsize'. This issue got exposed with 'targetcli' command. Signed-off-by: Vipin K Parashar Signed-off-by: Vaibhav Jain --- rtslib/utils.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/rtslib/utils.py b/rtslib/utils.py index 6974235..1ab8f50 100644 --- a/rtslib/utils.py +++ b/rtslib/utils.py @@ -19,6 +19,7 @@ import re import os +import sys import stat import uuid import glob @@ -619,7 +620,7 @@ def list_eth_names(max_eth=1024): struct. ''' SIOCGIFCONF = 0x8912 - if os.uname()[4].endswith("_64"): + if sys.maxsize > 2**32: offset = 40 else: offset = 32