summaryrefslogtreecommitdiff
path: root/lib/libc/sys
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2022-05-23 15:17:12 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2022-05-23 15:17:12 +0000
commit29683bb1f99c847d0679a2ec80f3af067363e15b (patch)
tree608d70e9082697f28a82b92933b4d0251f11f676 /lib/libc/sys
parent410a81fdfef7be310e3fc8665dc07043720126af (diff)
Respect RLIMIT_FSIZE when extending a file via truncat(2)/ftruncate(2).
This refactors the commin parts of sys_truncate() and sys_ftruncate() into dotruncate(). If the new size of the file is larger than the RLIMIT_FSIZE limit _and_ the file is being extended, not truncated, return EFBIG. Adapted from a diff by Piotr Durlej. With help from and OK by deraadt@ guenther@.
Diffstat (limited to 'lib/libc/sys')
-rw-r--r--lib/libc/sys/truncate.27
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/libc/sys/truncate.2 b/lib/libc/sys/truncate.2
index 820583c650e..6356841033d 100644
--- a/lib/libc/sys/truncate.2
+++ b/lib/libc/sys/truncate.2
@@ -1,4 +1,4 @@
-.\" $OpenBSD: truncate.2,v 1.20 2020/02/11 13:19:17 schwarze Exp $
+.\" $OpenBSD: truncate.2,v 1.21 2022/05/23 15:17:11 millert Exp $
.\" $NetBSD: truncate.2,v 1.7 1995/02/27 12:39:00 cgd Exp $
.\"
.\" Copyright (c) 1983, 1991, 1993
@@ -30,7 +30,7 @@
.\"
.\" @(#)truncate.2 8.1 (Berkeley) 6/4/93
.\"
-.Dd $Mdocdate: February 11 2020 $
+.Dd $Mdocdate: May 23 2022 $
.Dt TRUNCATE 2
.Os
.Sh NAME
@@ -73,7 +73,8 @@ is a negative value.
.It Bq Er EFBIG
The
.Fa length
-exceeds the maximum file size of the underlying filesystem.
+exceeds the process's file size limit or the maximum file size
+of the underlying filesystem.
.It Bq Er EIO
An I/O error occurred updating the inode.
.El