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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <nabijaczleweli@xxxxxxxxxxxxxxxxxx>
---
 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

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Kernel Documentation]     [Netdev]     [Linux Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux