From owner-freebsd-bugs@FreeBSD.ORG Thu Jun 10 12:20:43 2004 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B9BA916A4CE for ; Thu, 10 Jun 2004 12:20:43 +0000 (GMT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9B8C443D5E for ; Thu, 10 Jun 2004 12:20:43 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.11/8.12.11) with ESMTP id i5ACKLn9050660 for ; Thu, 10 Jun 2004 12:20:21 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.11/8.12.11/Submit) id i5ACKLp9050659; Thu, 10 Jun 2004 12:20:21 GMT (envelope-from gnats) Resent-Date: Thu, 10 Jun 2004 12:20:21 GMT Resent-Message-Id: <200406101220.i5ACKLp9050659@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Amir Shalem Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id BA80416A4CE; Thu, 10 Jun 2004 12:13:25 +0000 (GMT) Received: from marco.bezeqint.net (marco.bezeqint.net [192.115.104.4]) by mx1.FreeBSD.org (Postfix) with ESMTP id 2A8A643D1D; Thu, 10 Jun 2004 12:13:25 +0000 (GMT) (envelope-from amir@active.ath.cx) Received: from marco.bezeqint.net (localhost [127.0.0.1]) SMTP id 2891BFC92A; Thu, 10 Jun 2004 15:13:23 +0300 (IDT) Received: from active.ath.cx ([IP=82.81.29.96]) by eSafe SMTP Relay 1086824256; Thu Jun 10 15:13:22 2004 Received: from localhost (localhost.active.ath.cx [127.0.0.1]) by active.ath.cx (Postfix) with ESMTP id 45E8F5D09; Thu, 10 Jun 2004 15:13:22 +0300 (IDT) Received: from active.ath.cx ([127.0.0.1]) by localhost (active.ath.cx [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 52585-03; Thu, 10 Jun 2004 15:13:21 +0300 (IDT) Received: by active.ath.cx (Postfix, from userid 1000) id DFADB5D08; Thu, 10 Jun 2004 15:13:20 +0300 (IDT) Message-Id: <20040610121320.DFADB5D08@active.ath.cx> Date: Thu, 10 Jun 2004 15:13:20 +0300 (IDT) From: Amir Shalem To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 cc: phk@FreeBSD.org Subject: misc/67793: gbde doesn't complain correctly when file does not exists. X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: Amir Shalem List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Jun 2004 12:20:43 -0000 >Number: 67793 >Category: misc >Synopsis: gbde doesn't complain correctly when file does not exists. >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Thu Jun 10 12:20:21 GMT 2004 >Closed-Date: >Last-Modified: >Originator: Amir Shalem >Release: FreeBSD 5.2-CURRENT i386 >Organization: None >Environment: System: FreeBSD active.ath.cx 5.2-CURRENT FreeBSD 5.2-CURRENT #0: Wed May 5 21:12:19 IDT 2004 amir@active.ath.cx:/usr/obj/usr/src/sys/ACTIVE i386 >Description: gbde doesn't open the device correctly, it tries to open it with O_CREAT, which in case the file doesn't exists (or was given without /dev/) it creates it. beside creating the file, which doesn't fails, it tries than to ioctl() it, which fails ofcourse, so, what the user sees is: gbde: read: Inappropriate ioctl for device instand of: gbde: file: No such file or directory >How-To-Repeat: in a directory where user can create files: $ gbde init ad0s1f $ gbde destroy test any command which involves setting doopen in gbde.c >Fix: remove the O_CREAT flag. --- gbde.c.orig Thu Jun 10 15:05:10 2004 +++ gbde.c Thu Jun 10 15:01:13 2004 @@ -795,13 +795,13 @@ } if (doopen) { - dfd = open(dest, O_RDWR | O_CREAT, 0644); + dfd = open(dest, O_RDWR, 0644); if (dfd < 0) { if (snprintf(buf, sizeof(buf), "%s%s", _PATH_DEV, dest) >= (ssize_t)sizeof(buf)) errno = ENAMETOOLONG; else - dfd = open(buf, O_RDWR | O_CREAT, 0644); + dfd = open(buf, O_RDWR, 0644); } if (dfd < 0) err(1, "%s", dest); >Release-Note: >Audit-Trail: >Unformatted: