fix bug in file-not-found due to incomplete init of the ios_t
This commit is contained in:
parent
8dba83c8cd
commit
1ca42ea732
|
@ -28,11 +28,8 @@ void relocate_iostream(value_t oldv, value_t newv)
|
||||||
{
|
{
|
||||||
ios_t *olds = value2c(ios_t*, oldv);
|
ios_t *olds = value2c(ios_t*, oldv);
|
||||||
ios_t *news = value2c(ios_t*, newv);
|
ios_t *news = value2c(ios_t*, newv);
|
||||||
cvalue_t *cv = (cvalue_t*)ptr(oldv);
|
if (news->buf == &olds->local[0]) {
|
||||||
if (isinlined(cv)) {
|
news->buf = &news->local[0];
|
||||||
if (olds->buf == &olds->local[0]) {
|
|
||||||
news->buf = &news->local[0];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -752,9 +752,9 @@ ios_t *ios_file(ios_t *s, char *fname, int rd, int wr, int create, int trunc)
|
||||||
if (create) flags |= O_CREAT;
|
if (create) flags |= O_CREAT;
|
||||||
if (trunc) flags |= O_TRUNC;
|
if (trunc) flags |= O_TRUNC;
|
||||||
fd = open(fname, flags, S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH/*644*/);
|
fd = open(fname, flags, S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH/*644*/);
|
||||||
|
s = ios_fd(s, fd, 1, 1);
|
||||||
if (fd == -1)
|
if (fd == -1)
|
||||||
goto open_file_err;
|
goto open_file_err;
|
||||||
s = ios_fd(s, fd, 1, 1);
|
|
||||||
if (!wr)
|
if (!wr)
|
||||||
s->readonly = 1;
|
s->readonly = 1;
|
||||||
return s;
|
return s;
|
||||||
|
|
Loading…
Reference in New Issue