0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-12-01 09:32:32 +01:00

Use pwrite and pread rather than lseek

This commit is contained in:
Mathias Stearn 2010-12-22 12:33:55 -05:00
parent 48d3c2dff5
commit dcffbd661d

View File

@ -149,12 +149,10 @@ public:
_bad = false;
}
void write(fileofs o, const char *data, unsigned len) {
lseek(fd, o, SEEK_SET);
err( ::write(fd, data, len) == (int) len );
err( ::pwrite(fd, data, len, o) == (int) len );
}
void read(fileofs o, char *data, unsigned len) {
lseek(fd, o, SEEK_SET);
err( ::read(fd, data, len) == (int) len );
err( ::pread(fd, data, len, o) == (int) len );
}
bool bad() { return _bad; }
bool is_open() { return fd > 0; }