Commit c0dd86b9 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent a11ba478
......@@ -32,9 +32,11 @@ namespace os {
tuple<File, error> open(const string &path, int flags, mode_t mode) {
File f = {._fd = -1, .path = path};
int err = ::open(path.c_str(), flags, mode);
if (err != 0)
return make_tuple(f, f._errno("open"));
f._fd = ::open(path.c_str(), flags, mode);
error err;
if (f._fd == -1)
err = f._errno("open");
return make_tuple(f, err);
}
error File::close() {
......@@ -43,6 +45,7 @@ error File::close() {
int err = ::close(f->_fd);
if (err != 0)
return f->_errno("close");
return nil;
}
error File::stat(struct stat *st) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment