Thread (2 messages) 2 messages, 2 authors, 2022-05-16

[PATCH] fseek.3: mention seek-past-the-end semantics, defer to lseek(2)

From: наб <hidden>
Date: 2022-05-16 20:08:22
Subsystem: the rest · Maintainer: Linus Torvalds

If the user is unfamiliar with seeking semantics, they may sensibly
assume that seeking past the end is invalid

Reported-in: https://twitter.com/eatijr/status/1526264195808911361
Signed-off-by: Ahelenia Ziemiańska <redacted>
---
 man3/fseek.3 | 8 ++++++++
 1 file changed, 8 insertions(+)
diff --git a/man3/fseek.3 b/man3/fseek.3
index 01bd34c5b..c19303421 100644
--- a/man3/fseek.3
+++ b/man3/fseek.3
@@ -118,6 +118,14 @@ On some non-UNIX systems, an
 .I fpos_t
 object may be a complex object and these routines may be the only way to
 portably reposition a text stream.
+.PP
+If the stream refers to a regular file
+and the resulting stream offset is beyond the size of the file,
+subsequent writes will extend the file with a hole, up to the offset,
+before committing any data.
+See
+.BR lseek (2)
+for details on file seeking semantics.
 .SH RETURN VALUE
 The
 .BR rewind ()
-- 
2.30.2

Attachments

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help