Date: Thu, 10 Jun 2004 15:13:20 +0300 (IDT) From: Amir Shalem <amir@active.ath.cx> To: FreeBSD-gnats-submit@FreeBSD.org Cc: phk@FreeBSD.org Subject: misc/67793: gbde doesn't complain correctly when file does not exists. Message-ID: <20040610121320.DFADB5D08@active.ath.cx> Resent-Message-ID: <200406101220.i5ACKLp9050659@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>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:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040610121320.DFADB5D08>