Skip to content

Commit 9a29a84

Browse files
radaretrufae
authored andcommitted
fi
1 parent 7264ca3 commit 9a29a84

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

libr/io/p/io_default.c

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -78,12 +78,7 @@ static bool mmap_refresh(RIOMMapFileObj *mmo) {
7878
}
7979
if (mmo->rawio) {
8080
mmo->fd = open_file (mmo->filename, mmo->perm, mmo->mode);
81-
if (mmo->nocache) {
82-
#ifdef F_NOCACHE
83-
fcntl (mmo->fd, F_NOCACHE, 1);
84-
#endif
85-
}
86-
return mmo->fd != -1;
81+
goto done;
8782
}
8883
const int fd = open_file (mmo->filename, mmo->perm, mmo->mode);
8984
if (fd == -1) {
@@ -96,6 +91,7 @@ static bool mmap_refresh(RIOMMapFileObj *mmo) {
9691
}
9792
mmo->rawio = true;
9893
mmo->fd = fd;
94+
done:
9995
#ifdef F_NOCACHE
10096
if (mmo->nocache) {
10197
fcntl (mmo->fd, F_NOCACHE, 1);
@@ -121,11 +117,14 @@ static RIOMMapFileObj *mmap_create(RIO *io, const char *filename, int perm, int
121117
} else if (r_str_startswith (filename, "stdio://")) {
122118
filename += strlen ("stdio://");
123119
mmo->rawio = true;
120+
} else if (r_str_startswith (filename, "nocache://")) {
121+
mmo->rawio = true;
122+
mmo->nocache = true;
123+
} else {
124+
// TODO later: mmo->rawio = true;
124125
}
125-
mmo->nocache = r_str_startswith (filename, "nocache://");
126126
if (mmo->nocache) {
127127
filename += strlen ("nocache://");
128-
mmo->rawio = true;
129128
}
130129
mmo->filename = strdup (filename);
131130
mmo->perm = perm;

0 commit comments

Comments
 (0)