From patchwork Sat Dec 27 03:35:08 2008 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Frysinger X-Patchwork-Id: 15779 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from bombadil.infradead.org (bombadil.infradead.org [18.85.46.34]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 3F0BFDDE19 for ; Sat, 27 Dec 2008 23:21:52 +1100 (EST) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.68 #1 (Red Hat Linux)) id 1LGY8S-0007SI-4x; Sat, 27 Dec 2008 12:19:16 +0000 Received: from smtp.gentoo.org ([140.211.166.183]) by bombadil.infradead.org with esmtps (Exim 4.68 #1 (Red Hat Linux)) id 1LGPxP-0007lR-Mq for linux-mtd@lists.infradead.org; Sat, 27 Dec 2008 03:35:20 +0000 Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.gentoo.org (Postfix) with ESMTP id C1F3964265 for ; Sat, 27 Dec 2008 03:35:08 +0000 (UTC) From: Mike Frysinger To: linux-mtd@lists.infradead.org Subject: [PATCH] mkfs.jffs2: fix dir creation in / Date: Fri, 26 Dec 2008 22:35:08 -0500 Message-Id: <1230348908-22199-1-git-send-email-vapier@gentoo.org> X-Mailer: git-send-email 1.6.0.6 In-Reply-To: <1230295082.11802.2.camel@sauron> References: <1230295082.11802.2.camel@sauron> X-Bad-Reply: References and In-Reply-To but no 'Re:' in Subject. X-Spam-Score: 0.0 (/) X-Mailman-Approved-At: Sat, 27 Dec 2008 07:19:14 -0500 X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.9 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-mtd-bounces@lists.infradead.org Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org With older mtd-utils, creating a directory in the root worked fine. With current git, the parent dir search algo breaks this. For example, just take the current git tree, build it up, and then run: $ ./mkfs.jffs2 -d . -D device_table.txt -o /dev/null mkfs.jffs2: skipping device_table entry '/dev': no parent directory! mkfs.jffs2: skipping device_table entry '/dev/mem': no parent directory! ... Doing `mkdir ./dev` first works around the issue, but where's the fun in that. Signed-off-by: Mike Frysinger --- mkfs.jffs2.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/mkfs.jffs2.c b/mkfs.jffs2.c index 7255536..23a8cf8 100644 --- a/mkfs.jffs2.c +++ b/mkfs.jffs2.c @@ -273,6 +273,11 @@ static struct filesystem_entry *find_filesystem_entry( struct filesystem_entry *e = dir; if (S_ISDIR(dir->sb.st_mode)) { + /* If this is the first call, and we actually want this + * directory, then return it now */ + if (strcmp(fullname, e->fullname) == 0) + return e; + e = dir->files; } while (e) {