sanity: Don't hard code value of ENAMETOOLONG

Although ENAMETOOLONG is 36 on Linux x86 and x86_64 it does isn't on other
architectures so the value shouldn't be hard coded.

(From OE-Core rev: 11a9cf5ee0daf82097fb2f36b58016f20a5968f3)

Signed-off-by: Mike Crowe <mac@mcrowe.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Mike Crowe 2013-11-25 15:20:15 +00:00 committed by Richard Purdie
parent d62ced4775
commit 181875b5d9
1 changed files with 3 additions and 2 deletions

View File

@ -183,8 +183,9 @@ def check_create_long_filename(filepath, pathname):
f.close()
os.remove(testfile)
except IOError as e:
errno, strerror = e.args
if errno == 36: # ENAMETOOLONG
import errno
err, strerror = e.args
if err == errno.ENAMETOOLONG:
return "Failed to create a file with a long name in %s. Please use a filesystem that does not unreasonably limit filename length.\n" % pathname
else:
return "Failed to create a file in %s: %s.\n" % (pathname, strerror)