From: Michael Kerrisk Date: Fri, 24 Jul 2020 11:26:38 +0000 (+0200) Subject: open.2: Say a bit more about what happens when 'mode' is wrongly omitted X-Git-Tag: man-pages-5.08~39 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=901c8ecf7c86123163583c3ce2ce201af1a5f1a3;p=thirdparty%2Fman-pages.git open.2: Say a bit more about what happens when 'mode' is wrongly omitted Signed-off-by: Michael Kerrisk --- diff --git a/man2/open.2 b/man2/open.2 index f83326cbc3..aedbe0460d 100644 --- a/man2/open.2 +++ b/man2/open.2 @@ -289,20 +289,28 @@ mount options described in .IP The .I mode -argument specifies the file mode bits be applied when a new file is created. -This argument must be supplied when +argument specifies the file mode bits to be applied when a new file is created. +If neither .B O_CREAT -or +nor .B O_TMPFILE is specified in -.IR flags ; -if neither +.IR flags , +then +.I mode +is ignored (and can thus be specified as 0, or simply omitted). +The +.I mode +argument +.B must +be supplied if .B O_CREAT -nor +or .B O_TMPFILE -is specified, then -.I mode -is ignored. +is specified in +.IR flags ; +if it is not supplied, +some arbitrary bytes from the stack will be applied as the file mode. .IP The effective mode is modified by the process's .I umask