aboutsummaryrefslogtreecommitdiffstats
path: root/disk-io.c
diff options
context:
space:
mode:
authorDavid Sterba <dsterba@suse.com>2016-05-20 13:09:17 +0200
committerDavid Sterba <dsterba@suse.com>2016-06-01 14:56:56 +0200
commitc27db1238a0be644fea7d36773a53dd6957c94ba (patch)
treeb7ae430f34109cbf758ec3181ad06b0ac995a480 /disk-io.c
parent6f508a01f58d4e349af7dcf1da3dce6bfa3acbb9 (diff)
downloadbtrfs-progs-c27db1238a0be644fea7d36773a53dd6957c94ba.tar.gz
btrfs-progs-c27db1238a0be644fea7d36773a53dd6957c94ba.tar.xz
btrfs-progs-c27db1238a0be644fea7d36773a53dd6957c94ba.zip
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.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/disk-io.c b/disk-io.c
index b4f185f..77eb0a6 100644
--- a/disk-io.c
+++ b/disk-io.c
@@ -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;