aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/fs/hostfs/hostfs_user.c
diff options
context:
space:
mode:
authorRichard Weinberger <richard@nod.at>2015-03-04 23:44:54 +0100
committerRichard Weinberger <richard@nod.at>2015-03-26 23:27:53 +0100
commitb98b91029cf8a6defc6311d4018c44f3b05fbec7 (patch)
tree7100a22cd77997fef0f131440e0dd62d4e4a59a5 /fs/hostfs/hostfs_user.c
parenthostfs: Use page_offset() (diff)
downloadwireguard-linux-b98b91029cf8a6defc6311d4018c44f3b05fbec7.tar.xz
wireguard-linux-b98b91029cf8a6defc6311d4018c44f3b05fbec7.zip
hostfs: No need to box and later unbox the file mode
There is really no point in having a function with 10 arguments. Reported-by: Daniel Walter <d.walter@0x90.at> Signed-off-by: Richard Weinberger <richard@nod.at>
Diffstat (limited to 'fs/hostfs/hostfs_user.c')
-rw-r--r--fs/hostfs/hostfs_user.c17
1 files changed, 3 insertions, 14 deletions
diff --git a/fs/hostfs/hostfs_user.c b/fs/hostfs/hostfs_user.c
index 9765dab95cbd..34ab81b21c93 100644
--- a/fs/hostfs/hostfs_user.c
+++ b/fs/hostfs/hostfs_user.c
@@ -175,21 +175,10 @@ void close_dir(void *stream)
closedir(stream);
}
-int file_create(char *name, int ur, int uw, int ux, int gr,
- int gw, int gx, int or, int ow, int ox)
+int file_create(char *name, int mode)
{
- int mode, fd;
-
- mode = 0;
- mode |= ur ? S_IRUSR : 0;
- mode |= uw ? S_IWUSR : 0;
- mode |= ux ? S_IXUSR : 0;
- mode |= gr ? S_IRGRP : 0;
- mode |= gw ? S_IWGRP : 0;
- mode |= gx ? S_IXGRP : 0;
- mode |= or ? S_IROTH : 0;
- mode |= ow ? S_IWOTH : 0;
- mode |= ox ? S_IXOTH : 0;
+ int fd;
+
fd = open64(name, O_CREAT | O_RDWR, mode);
if (fd < 0)
return -errno;