mirror of
https://github.com/matrix-construct/construct
synced 2024-12-27 07:54:05 +01:00
ircd::fs: Use lseek() for size(fd) overload.
This commit is contained in:
parent
79d4c15ff5
commit
e3827124e9
1 changed files with 13 additions and 4 deletions
17
ircd/fs.cc
17
ircd/fs.cc
|
@ -575,10 +575,19 @@ ircd::fs::uuid(const fd &fd,
|
||||||
size_t
|
size_t
|
||||||
ircd::fs::size(const fd &fd)
|
ircd::fs::size(const fd &fd)
|
||||||
{
|
{
|
||||||
struct stat stat;
|
const off_t cur
|
||||||
syscall(::fstat, fd, &stat);
|
{
|
||||||
return stat.st_size;
|
syscall(::lseek, fd, 0, SEEK_CUR)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const off_t end
|
||||||
|
{
|
||||||
|
syscall(::lseek, fd, 0, SEEK_END)
|
||||||
|
};
|
||||||
|
|
||||||
|
syscall(::lseek, fd, cur, SEEK_SET);
|
||||||
|
return end;
|
||||||
|
}
|
||||||
|
|
||||||
uint
|
uint
|
||||||
ircd::fs::posix_flags(const std::ios::open_mode &mode)
|
ircd::fs::posix_flags(const std::ios::open_mode &mode)
|
||||||
|
|
Loading…
Reference in a new issue