]> code.ossystems Code Review - openembedded-core.git/commitdiff
sanity: Don't hard code value of ENAMETOOLONG
authorMike Crowe <mac@mcrowe.com>
Mon, 25 Nov 2013 15:20:15 +0000 (15:20 +0000)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Mon, 25 Nov 2013 16:14:15 +0000 (16:14 +0000)
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.

Signed-off-by: Mike Crowe <mac@mcrowe.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/classes/sanity.bbclass

index 6807a23152094f884c7d6442350fdd15958123bd..b26ea6b3727e884ebdae022c668680b20f1d957d 100644 (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)