From 8b14af6546d542878a8ea6ca08e49e0cba2e34ef Mon Sep 17 00:00:00 2001
From: Samuel Thibault <samuel.thibault@ens-lyon.org>
Date: Fri, 14 Aug 2015 15:17:37 +0200
Subject: Make fakeroot return file types from underly fs

Fakeroot does not support faking them anyway, and they may change on the
underlying fs, e.g. when creating a local socket.

* trans/fakeroot.c (netfs_validate_stat): Return S_IFMT part of st_mode as
provided by underlying filesystem.
---
 trans/fakeroot.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'trans/fakeroot.c')

diff --git a/trans/fakeroot.c b/trans/fakeroot.c
index 4275152d..3c84ce70 100644
--- a/trans/fakeroot.c
+++ b/trans/fakeroot.c
@@ -482,7 +482,7 @@ netfs_validate_stat (struct node *np, struct iouser *cred)
   if (netfs_node_netnode (np)->faked & FAKE_AUTHOR)
     st.st_author = np->nn_stat.st_author;
   if (netfs_node_netnode (np)->faked & FAKE_MODE)
-    st.st_mode = np->nn_stat.st_mode;
+    st.st_mode = (st.st_mode & S_IFMT) | (np->nn_stat.st_mode & ~S_IFMT);
 
   np->nn_stat = st;
   np->nn_translated = S_ISLNK (st.st_mode) ? S_IFLNK : 0;
-- 
cgit v1.2.3