Skip to content

Commit e7dc177

Browse files
committed
fix docs & example for FileExt::write_at
1 parent 39f42ad commit e7dc177

File tree

1 file changed

+8
-1
lines changed
  • library/std/src/os/unix

1 file changed

+8
-1
lines changed

library/std/src/os/unix/fs.rs

+8-1
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,14 @@ pub trait FileExt {
149149
/// Note that similar to [`File::write`], it is not an error to return a
150150
/// short write.
151151
///
152+
/// # Bug
153+
/// On some systems, due to a [bug] with [`pwrite64`] (the underlying
154+
/// syscall), files opened with the `O_APPEND` flag fail to respect the
155+
/// offset parameter, always appending to the end of the file instead.
156+
///
152157
/// [`File::write`]: fs::File::write
158+
/// [`pwrite64`]: https://man7.org/linux/man-pages/man2/pwrite.2.html
159+
/// [bug]: https://man7.org/linux/man-pages/man2/pwrite.2.html#BUGS
153160
///
154161
/// # Examples
155162
///
@@ -159,7 +166,7 @@ pub trait FileExt {
159166
/// use std::os::unix::prelude::FileExt;
160167
///
161168
/// fn main() -> io::Result<()> {
162-
/// let file = File::open("foo.txt")?;
169+
/// let file = File::create("foo.txt")?;
163170
///
164171
/// // We now write at the offset 10.
165172
/// file.write_at(b"sushi", 10)?;

0 commit comments

Comments
 (0)