From f446c6513c39d928cc292ee574e91c4db09d34c8 Mon Sep 17 00:00:00 2001 From: Giacomo Tesio Date: Tue, 26 Sep 2017 01:11:59 +0200 Subject: [PATCH] jehanne: properly translate DMDIR in __stat_reader --- newlib/libc/sys/jehanne/libposix_conf.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/newlib/libc/sys/jehanne/libposix_conf.c b/newlib/libc/sys/jehanne/libposix_conf.c index 8cb3e8d82..946e7688b 100644 --- a/newlib/libc/sys/jehanne/libposix_conf.c +++ b/newlib/libc/sys/jehanne/libposix_conf.c @@ -110,6 +110,11 @@ __stat_reader(struct stat *s, const Dir *d) s->st_dev = d->dev; s->st_ino = d->qid.path; s->st_mode = d->mode; + /* we have to map types to UNIX */ + if(d->mode & DMDIR) + s->st_mode |= _IFDIR; + else + s->st_mode |= _IFREG; /* UNIX lack fantasy :-) */ s->st_nlink = 1; s->st_uid = 1; s->st_gid = 1; @@ -185,7 +190,7 @@ open_translator(int flag, int mode, long *omode, long *cperm) if(flag & O_CREAT){ if(flag & O_DIRECTORY){ /* let's copy NetBSD's behaviour - * see hhttps://stackoverflow.com/questions/45818628/ + * see https://stackoverflow.com/questions/45818628/ */ return PosixEINVAL; }