Patchwork [2/2] sanity: Don't hard code value of ENAMETOOLONG

login
register
mail settings
Submitter Mike Crowe
Date Nov. 25, 2013, 3:20 p.m.
Message ID <1385392815-29916-2-git-send-email-mac@mcrowe.com>
Download mbox | patch
Permalink /patch/62307/
State Accepted
Commit 181875b5d9e5e4826557c2e44cf37e47d14e5e63
Headers show

Comments

Mike Crowe - Nov. 25, 2013, 3:20 p.m.
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>
---
 meta/classes/sanity.bbclass |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Patch

diff --git a/meta/classes/sanity.bbclass b/meta/classes/sanity.bbclass
index 0d40792..8531df1 100644
--- a/meta/classes/sanity.bbclass
+++ b/meta/classes/sanity.bbclass
@@ -184,8 +184,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)