From owner-freebsd-bugs Sat Nov 3 17:10:13 2001 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 24CE437B416 for ; Sat, 3 Nov 2001 17:10:02 -0800 (PST) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.4/8.11.4) id fA41A1822849; Sat, 3 Nov 2001 17:10:01 -0800 (PST) (envelope-from gnats) Received: from w250.z064001178.sjc-ca.dsl.cnc.net (w250.z064001178.sjc-ca.dsl.cnc.net [64.1.178.250]) by hub.freebsd.org (Postfix) with SMTP id B780F37B405 for ; Sat, 3 Nov 2001 17:07:49 -0800 (PST) Received: (qmail 34036 invoked by uid 1000); 4 Nov 2001 01:08:10 -0000 Message-Id: <20011104010810.34035.qmail@lizzy.bugworks.com> Date: 4 Nov 2001 01:08:10 -0000 From: Jos Backus Reply-To: Jos@lizzy.bugworks.com, "Backus <@lizzy.bugworks.com Jos Backus" To: FreeBSD-gnats-submit@freebsd.org X-Send-Pr-Version: 3.113 Subject: kern/31742: open("/dev/null", O_TRUNC) broken on -current Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org >Number: 31742 >Category: kern >Synopsis: open("/dev/null", O_TRUNC) broken on -current >Confidential: no >Severity: serious >Priority: high >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sat Nov 03 17:10:01 PST 2001 >Closed-Date: >Last-Modified: >Originator: Jos Backus >Release: FreeBSD 5.0-CURRENT i386 >Organization: none >Environment: System: FreeBSD lizzy.bugworks.com 5.0-CURRENT FreeBSD 5.0-CURRENT #17: Sat Nov 3 15:04:31 PST 2001 jos@lizzy.bugworks.com:/disk0/usr/obj/usr/src/sys/LIZZY i386 lizzy:/tmp% ls -ld /dev dr-xr-xr-x 4 root wheel 0 Nov 3 07:15 /dev lizzy:/tmp% ls -l /dev/null crw-rw-rw- 1 root wheel 2, 2 Nov 3 17:04 /dev/null lizzy:/tmp% >Description: open("/dev/null", O_TRUNC) fails with EPERM. >How-To-Repeat: lizzy:/tmp% cat c.c #include #include int main(int argc, char *argv[]) { char *s = "string"; int fd; int flag = 0; if (argc > 1) flag = O_TRUNC; if ((fd = open("/dev/null", O_CREAT|O_WRONLY|flag)) == -1) err(1, "open"); write(fd, s, strlen(s)); close(fd); exit(0); } lizzy:/tmp% make c cc -O -pipe -march=pentiumpro c.c -o c lizzy:/tmp% ./c lizzy:/tmp% ./c 1 c: open: Operation not permitted lizzy:/tmp% >Fix: >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message