diff options
author | David Sterba <dsterba@suse.com> | 2016-05-20 13:09:17 +0200 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2016-06-01 14:56:56 +0200 |
commit | c27db1238a0be644fea7d36773a53dd6957c94ba (patch) | |
tree | b7ae430f34109cbf758ec3181ad06b0ac995a480 /disk-io.c | |
parent | 6f508a01f58d4e349af7dcf1da3dce6bfa3acbb9 (diff) |
btrfs-progs: drop O_CREATE from open_ctree_fs_info
We stat the filesystem path before trying to open it so there's no point
to pass O_CREAT ("btrfs-progs: add stat check in open_ctree_fs_info").
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'disk-io.c')
-rw-r--r-- | disk-io.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -1328,7 +1328,7 @@ struct btrfs_fs_info *open_ctree_fs_info(const char *filename, int fp; int ret; struct btrfs_fs_info *info; - int oflags = O_CREAT | O_RDWR; + int oflags = O_RDWR; struct stat st; ret = stat(filename, &st); @@ -1344,7 +1344,7 @@ struct btrfs_fs_info *open_ctree_fs_info(const char *filename, if (!(flags & OPEN_CTREE_WRITES)) oflags = O_RDONLY; - fp = open(filename, oflags, 0600); + fp = open(filename, oflags); if (fp < 0) { error("cannot open '%s': %s", filename, strerror(errno)); return NULL; |