summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2015-12-16 14:17:56 +0000
committerDamien George <damien.p.george@gmail.com>2015-12-16 14:17:56 +0000
commit0d7de08e064dd124bd9a8c95bf6cef284a6bd4d9 (patch)
tree5f5c4c4bdcc94200eccb09588482d1f0b77d3476
parent64a909ef5113925adef19f275f62473de8ee68c5 (diff)
downloadmicropython-0d7de08e064dd124bd9a8c95bf6cef284a6bd4d9.tar.gz
micropython-0d7de08e064dd124bd9a8c95bf6cef284a6bd4d9.zip
unix: Change define logic of _DIRENT_HAVE_D_INO to match other macros.
-rw-r--r--unix/modos.c2
-rw-r--r--unix/mpconfigport.h5
-rw-r--r--unix/mpconfigport_freedos.h2
3 files changed, 7 insertions, 2 deletions
diff --git a/unix/modos.c b/unix/modos.c
index 580722db72..26ecdd5b13 100644
--- a/unix/modos.c
+++ b/unix/modos.c
@@ -184,7 +184,7 @@ STATIC mp_obj_t listdir_next(mp_obj_t self_in) {
// DT_UNKNOWN should have 0 value on any reasonable system
t->items[1] = MP_OBJ_NEW_SMALL_INT(0);
#endif
- #if !defined(_DIRENT_HAVE_D_INO) || _DIRENT_HAVE_D_INO
+ #ifdef _DIRENT_HAVE_D_INO
t->items[2] = MP_OBJ_NEW_SMALL_INT(dirent->d_ino);
#else
t->items[2] = MP_OBJ_NEW_SMALL_INT(0);
diff --git a/unix/mpconfigport.h b/unix/mpconfigport.h
index 5fd122e96e..49f8794048 100644
--- a/unix/mpconfigport.h
+++ b/unix/mpconfigport.h
@@ -259,3 +259,8 @@ extern const struct _mp_obj_fun_builtin_t mp_builtin_open_obj;
#ifndef _DIRENT_HAVE_D_TYPE
#define _DIRENT_HAVE_D_TYPE (1)
#endif
+// This macro is not provided by glibc but we need it so ports that don't have
+// dirent->d_ino can disable the use of this field.
+#ifndef _DIRENT_HAVE_D_INO
+#define _DIRENT_HAVE_D_INO (1)
+#endif
diff --git a/unix/mpconfigport_freedos.h b/unix/mpconfigport_freedos.h
index 780911fd61..772a92a62b 100644
--- a/unix/mpconfigport_freedos.h
+++ b/unix/mpconfigport_freedos.h
@@ -35,4 +35,4 @@
#define MICROPY_PY_SYS_PLATFORM "freedos"
// djgpp dirent struct does not have d_ino field
-#define _DIRENT_HAVE_D_INO (0)
+#undef _DIRENT_HAVE_D_INO