Commit 160e1e90 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent c0611d70
...@@ -46,6 +46,7 @@ error File::close() { ...@@ -46,6 +46,7 @@ error File::close() {
int err = ::close(f->_fd); int err = ::close(f->_fd);
if (err != 0) if (err != 0)
return f->_errno("close"); return f->_errno("close");
f->_fd = -1;
return nil; return nil;
} }
...@@ -59,7 +60,7 @@ error File::stat(struct stat *st) { ...@@ -59,7 +60,7 @@ error File::stat(struct stat *st) {
} }
// _errno returns error corresponding to op and errno. // _errno returns error corresponding to file->op and errno.
error File::_errno(const char *op) { error File::_errno(const char *op) {
File *f = this; File *f = this;
char ebuf[128]; char ebuf[128];
...@@ -73,6 +74,7 @@ error File::_errno(const char *op) { ...@@ -73,6 +74,7 @@ error File::_errno(const char *op) {
// fmt:: // fmt::
namespace fmt { namespace fmt {
static
string _vsprintf(const string &format, va_list argp) { string _vsprintf(const string &format, va_list argp) {
// based on https://stackoverflow.com/a/26221725/9456786 // based on https://stackoverflow.com/a/26221725/9456786
va_list argp2; va_list argp2;
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
// See COPYING file for full licensing terms. // See COPYING file for full licensing terms.
// See https://www.nexedi.com/licensing for rationale and options. // See https://www.nexedi.com/licensing for rationale and options.
// wcfs_misc.{h,cpp} provide miscelanneous utilities for other wcfs_* files. // wcfs_misc.{h,cpp} provide miscellaneous utilities for other wcfs_* files.
#ifndef _NXD_WCFS_MISC_H_ #ifndef _NXD_WCFS_MISC_H_
#define _NXD_WCFS_MISC_H_ #define _NXD_WCFS_MISC_H_
...@@ -30,7 +30,7 @@ using std::tuple; ...@@ -30,7 +30,7 @@ using std::tuple;
using std::make_tuple; using std::make_tuple;
using std::tie; using std::tie;
// nil is synonim for nullptr and NULL. // nil is synonym for nullptr and NULL.
const nullptr_t nil = nullptr; const nullptr_t nil = nullptr;
// error mimics error from Go. // error mimics error from Go.
......
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