about summary refs log tree commit diff
diff options
context:
space:
mode:
authordarklyspaced <srohanjd@gmail.com>2023-07-20 11:27:13 +0800
committerdarklyspaced <srohanjd@gmail.com>2023-07-20 11:27:13 +0800
commite7dc177442e7c91ea0c691a992a634ac879db16f (patch)
tree5d46a656506622ff1e501a41a9330be8c9b00590
parent39f42ad9e8430a8abb06c262346e89593278c515 (diff)
downloadrust-e7dc177442e7c91ea0c691a992a634ac879db16f.tar.gz
rust-e7dc177442e7c91ea0c691a992a634ac879db16f.zip
fix docs & example for FileExt::write_at
-rw-r--r--library/std/src/os/unix/fs.rs9
1 files changed, 8 insertions, 1 deletions
diff --git a/library/std/src/os/unix/fs.rs b/library/std/src/os/unix/fs.rs
index 1e1c3693105..358ab33fffd 100644
--- a/library/std/src/os/unix/fs.rs
+++ b/library/std/src/os/unix/fs.rs
@@ -149,7 +149,14 @@ pub trait FileExt {
     /// Note that similar to [`File::write`], it is not an error to return a
     /// short write.
     ///
+    /// # Bug
+    /// On some systems, due to a [bug] with [`pwrite64`] (the underlying
+    /// syscall), files opened with the `O_APPEND` flag fail to respect the
+    /// offset parameter, always appending to the end of the file instead.
+    ///
     /// [`File::write`]: fs::File::write
+    /// [`pwrite64`]: https://man7.org/linux/man-pages/man2/pwrite.2.html
+    /// [bug]: https://man7.org/linux/man-pages/man2/pwrite.2.html#BUGS
     ///
     /// # Examples
     ///
@@ -159,7 +166,7 @@ pub trait FileExt {
     /// use std::os::unix::prelude::FileExt;
     ///
     /// fn main() -> io::Result<()> {
-    ///     let file = File::open("foo.txt")?;
+    ///     let file = File::create("foo.txt")?;
     ///
     ///     // We now write at the offset 10.
     ///     file.write_at(b"sushi", 10)?;