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>
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);
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;