diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2018-09-12 09:04:37 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2018-09-17 09:33:45 +0200 |
commit | c4eea235ecda4d7064f494384624ebd50e815f56 (patch) | |
tree | 1866441c8a6f02a7b05d370f2a8c72d0be561507 | |
parent | 742ba2bf084c8d7f6db6af5ce02ebc4d848df013 (diff) | |
download | barebox-c4eea235ecda4d7064f494384624ebd50e815f56.tar.gz barebox-c4eea235ecda4d7064f494384624ebd50e815f56.tar.xz |
fs: devfs: Create device files as character devices
Without this files in /dev/ appear as regular files. copy_file()
stumbles upon this as it tries a truncate() on that files which
then fails. Create the files as character devices so that copy_file()
works as expected.
Fixes: 9137c41915 ("fs: devfs: Switch to dentry cache implementation")
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Tested-by: Giorgio Dal Molin <giorgio.nicole@arcor.de>
-rw-r--r-- | fs/devfs.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/devfs.c b/fs/devfs.c index 5d0bb2c674..84c619f1ed 100644 --- a/fs/devfs.c +++ b/fs/devfs.c @@ -226,7 +226,7 @@ static struct inode *devfs_get_inode(struct super_block *sb, const struct inode switch (mode & S_IFMT) { default: return NULL; - case S_IFREG: + case S_IFCHR: inode->i_op = &devfs_file_inode_operations; inode->i_fop = &devfs_file_operations; break; @@ -251,7 +251,7 @@ static struct dentry *devfs_lookup(struct inode *dir, struct dentry *dentry, if (!cdev) return ERR_PTR(-ENOENT); - inode = devfs_get_inode(dir->i_sb, dir, S_IFREG | S_IRWXUGO); + inode = devfs_get_inode(dir->i_sb, dir, S_IFCHR | S_IRWXUGO); if (!inode) return ERR_PTR(-ENOMEM); |