From patchwork Wed Dec 17 19:50:07 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= X-Patchwork-Id: 422358 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from arrakis.dune.hu (arrakis.dune.hu [78.24.191.176]) (using TLSv1.1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 59BC01400EA for ; Thu, 18 Dec 2014 06:50:31 +1100 (AEDT) Received: from arrakis.dune.hu (localhost [127.0.0.1]) by arrakis.dune.hu (Postfix) with ESMTP id B6802284E91; Wed, 17 Dec 2014 20:48:29 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on arrakis.dune.hu X-Spam-Level: X-Spam-Status: No, score=-1.2 required=5.0 tests=BAYES_00, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, T_DKIM_INVALID autolearn=no version=3.3.2 Received: from arrakis.dune.hu (localhost [127.0.0.1]) by arrakis.dune.hu (Postfix) with ESMTP id 2AAA1284E91 for ; Wed, 17 Dec 2014 20:48:26 +0100 (CET) X-policyd-weight: using cached result; rate: -8.5 Received: from mail-wg0-f53.google.com (mail-wg0-f53.google.com [74.125.82.53]) by arrakis.dune.hu (Postfix) with ESMTPS for ; Wed, 17 Dec 2014 20:48:23 +0100 (CET) Received: by mail-wg0-f53.google.com with SMTP id l18so21209876wgh.40 for ; Wed, 17 Dec 2014 11:50:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:mime-version:content-type :content-transfer-encoding; bh=mG7vgvKlODa8MQCZLa2M/oji9s9AeqEKPHcAOjxNV5A=; b=KrZVDtDPFEAdTlIojl5ZzqSAxbVgqMRw99UlKB13v/a4B4NehvKiDEGKDF7g4+wOjN 6ZfEHb5KRcFtmlg2anqqT7EadCwe6s3i1BNjnagnBR4Xor7wNWtTLVSqdW7e/IXmGNV/ QOK0xXdkZMhxRch9CNOWZooRe34nUqImgowmKyYBjfkgrEP2f+00y8TBC3FkfPjO7ckm IPX9Czkw9H3pwYejywL13mv6HPyT4R6DD5Ix1fhNw3Wx2VuZ6/xd18Fu/FKTyjGLRRgo Smr3JfhSN+SAa3zi4Cn2OmcdEx2LDoaMvIqe/9LxfWLsuecJXzHzpXrdrkgleeLMD2ZJ CSAg== X-Received: by 10.194.90.10 with SMTP id bs10mr76398339wjb.43.1418845812869; Wed, 17 Dec 2014 11:50:12 -0800 (PST) Received: from linux-tdhb.lan (ip-194-187-74-233.konfederacka.maverick.com.pl. [194.187.74.233]) by mx.google.com with ESMTPSA id gl5sm22034980wib.0.2014.12.17.11.50.11 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 17 Dec 2014 11:50:12 -0800 (PST) From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= To: Felix Fietkau Date: Wed, 17 Dec 2014 20:50:07 +0100 Message-Id: <1418845807-28018-1-git-send-email-zajec5@gmail.com> X-Mailer: git-send-email 1.8.4.5 MIME-Version: 1.0 Cc: openwrt-devel@lists.openwrt.org Subject: [OpenWrt-Devel] [PATCH fstools] block: make sure /etc/ exists on the extroot X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: openwrt-devel-bounces@lists.openwrt.org Sender: "openwrt-devel" Otherwise opening .extroot-uuid could fail. Signed-off-by: Rafał Miłecki --- block.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/block.c b/block.c index 107ba64..c29017d 100644 --- a/block.c +++ b/block.c @@ -911,6 +911,10 @@ static int check_extroot(char *path) char tag[64]; char uuid[64] = { 0 }; + snprintf(tag, sizeof(tag), "%s/etc", path); + if (stat(tag, &s)) + mkdir_p(tag); + snprintf(tag, sizeof(tag), "%s/etc/.extroot-uuid", path); if (stat(tag, &s)) { fp = fopen(tag, "w+");