Subject: bin/17885: open() with O_CREAT but no mode argument
To: None <>
From: Martin J. Laubach <>
List: netbsd-bugs
Date: 08/08/2002 23:48:00
>Number:         17885
>Category:       bin
>Synopsis:       open() with O_CREAT but no mode argument
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Aug 08 14:49:00 PDT 2002
>Originator:     Martin J. Laubach
>Release:        NetBSD 1.6D
System: NetBSD 1.6D NetBSD 1.6D (CELERY) #8: Mon Aug 5 04:53:51 CEST 2002 macppc
Architecture: powerpc
Machine: macppc

  An automated audit of our source tree brought the list below
of open() calls with O_CREAT but no third (mode) argument, thus
using some random value on the stack as the (new) file modes.

  This PR is mainly to remind me to look at that, but if someone
beats me to it, feel free!

! ./crypto/dist/heimdal/appl/dceutils/k5dcecon.c: (("/tmp/k5dce.debug",O_WRONLY|O_CREAT|O_APPEND))
! ./crypto/dist/heimdal/appl/kauth/kauth.c: ((tf, O_CREAT|O_EXCL|O_RDWR))
! ./crypto/dist/krb4/appl/afsutil/pagsh.c: ((tf, O_CREAT|O_EXCL|O_RDWR))
! ./crypto/dist/krb4/appl/kauth/kauth.c: ((tf, O_CREAT|O_EXCL|O_RDWR))
! ./lib/libc/gen/utmpx.c: ((fname, O_RDWR|O_CREAT|O_EXLOCK, 0, DB_HASH, NULL))
! ./usr.sbin/sup/source/supcmeat.c: ((tname, O_WRONLY | O_CREAT | O_TRUNC))
! ./gnu/dist/gdb/29k-share/udi/udip2soc.c: ((soc_con[cnt].tip_string, O_CREAT))
! ./gnu/dist/toolchain/gcc/collect2.c: ((redir, O_WRONLY | O_TRUNC | O_CREAT))
! ./gnu/dist/toolchain/gdb/29k-share/udi/udip2soc.c: ((soc_con[cnt].tip_string, O_CREAT))