Message ID | 20181201165144.21161-1-sbabic@denx.de |
---|---|
State | Changes Requested |
Headers | show
Return-Path: <swupdate+bncBCXPLOXJ6IKRBJXYRLQAKGQECNEITVA@googlegroups.com> X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=googlegroups.com (client-ip=2a00:1450:4864:20::43b; helo=mail-wr1-x43b.google.com; envelope-from=swupdate+bncbcxploxj6ikrbjxyrlqakgqecneitva@googlegroups.com; receiver=<UNKNOWN>) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=googlegroups.com header.i=@googlegroups.com header.b="WM2fn5E6"; dkim-atps=neutral Received: from mail-wr1-x43b.google.com (mail-wr1-x43b.google.com [IPv6:2a00:1450:4864:20::43b]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 436cjj74rHz9s55 for <incoming@patchwork.ozlabs.org>; Sun, 2 Dec 2018 03:51:53 +1100 (AEDT) Received: by mail-wr1-x43b.google.com with SMTP id e14sf6645401wru.19 for <incoming@patchwork.ozlabs.org>; Sat, 01 Dec 2018 08:51:53 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1543683111; cv=pass; d=google.com; s=arc-20160816; b=IPWFilZJPWVIamvhE2Yslgv6/+o4g7SKOqkivDfJ7y1L3kSt8cKjEBhhmii8mEXJ+n WbwjbWdtf9JtMIkVp2lTavWXs2ak4qN7oTzv+Pjly71GFVHeDpVqB3i+gRr1TdtoVIMi dVXFYXAlOTA8xMbIwDqVfHy//XFg4Ir6iMdpYFx0P8NKW/A45DTniRDPubWF7T69SrOX AtgalmUNtIR7TSYpOVl0ZWmtpYhFpFvOnpUDbxKhsraz3FC9DZoK2KW881U8TbH506fm u2M73SxBkrgGdxXSa2Zcn8PSrDtB4gLiUCs8ToUaT8+r+vUA+eNYlYufCRDnO7l2sdyJ iIBA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:message-id:date:subject:cc:to:from :mime-version:sender:dkim-signature; bh=O48frZNglA8T/zctwYjgJtBVFWULQmL9IGBsnKHv7zw=; b=mOMLNzWnaqkMYT5+6mQzhseJ9nkk+vjoE25eua3M1WVrqNJbjN9WTMZUfj19cVxQ2P OQxPvv52V4kER2rLcQfUQsR8uUBsyVm0CcovWmb6BdY0S6X/hDisNumIY38AyOycp9Ac gGutCgKxM5GjKZeb/vGXUbyQ4VMujLQDDbdZDCA9rtPQUlSaivGc0FDdq68gGzWCV4iw Pn8n+3zge5L1dgNW0u5V765u6+fD6e/hrq0W1f25K8JFDLJvHNMztCMmM0SxaSqSrZ5P JnwRBwmRY128gVSIkbbXg8/XVhhJrFrjBph/cTcBJA7UYoh1orAOBhMGRbpzWXAZg0gU B+KQ== ARC-Authentication-Results: i=2; gmr-mx.google.com; spf=neutral (google.com: 212.18.0.9 is neither permitted nor denied by best guess record for domain of sbabic@denx.de) smtp.mailfrom=sbabic@denx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20161025; h=sender:mime-version:from:to:cc:subject:date:message-id :x-original-sender:x-original-authentication-results:precedence :mailing-list:list-id:list-post:list-help:list-archive :list-subscribe:list-unsubscribe; bh=O48frZNglA8T/zctwYjgJtBVFWULQmL9IGBsnKHv7zw=; b=WM2fn5E6qR8YOt74mzcm4SbJ20cCaYrSgAQj/9L1ommThEjiQJixBHDNT11O37eeWf LjXpVKqyW+N90W4FNE0lsXbKWRblQTvbE9zccYkXaoggF+M5sA8RFN6GsyPE20WFss1o SOHN8LcIYxJo8ss6K62vLLP7htYFsykk+IYkkhw5Zwa9OyT9995uvXMWDuiyP0YSVg8z yGAVFJkOUVt7tZ6DuoaK8KIl8YtslZGcVQT2vVDADj8awWj7ORPYY9IKQTQrz7NKLG/g 85Nymg/m0qQ9exE9aCzyIilWG7oLilPGoUgPRNMoMOhlaCefeSghNHG8GHvinGdP7CEi Ns3w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=sender:x-gm-message-state:mime-version:from:to:cc:subject:date :message-id:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:x-spam-checked-in-group:list-post :list-help:list-archive:list-subscribe:list-unsubscribe; bh=O48frZNglA8T/zctwYjgJtBVFWULQmL9IGBsnKHv7zw=; b=oJGyq5g+m4/jj3OL8aPBUDkj+/wxx2rPPPporZJTJ8s9Re7IZRqYSS+ZTR8FOtQaMz r2uUOt/WB2Tqx2FRGcpFAXefnu6E88j9PvJEsSnXo+zQ9C8eDQFyRCAMO8UfhVAGpIx5 IxNgSX1tqmXRbyLU62IC01i5Sg2/2NFBBjCTBUYY1/UHhk7XQkI8taecYqPY6C7m3ukH Y6U9tbPfWfsciDzbeC3gwNL978IGcxyahsGihY4uTyz6khAttv9dAaQZsYuTQChVNh7c m0m4o/tjqZ2m5Py8sEYKwKe4Vsrd/zGQydf3qYfbMcr5f+bZrGuHd1I4WcdcH2Bmxbz9 fAxA== Sender: swupdate@googlegroups.com X-Gm-Message-State: AA+aEWZcf8N+kNPDIdyfuMNtEoHRj9EXJ9uXSG58/GzOH94tkRQP6klE z+0U0jHHijjdk50+UmsskHU= X-Google-Smtp-Source: AFSGD/WePaWftXEvdj/R32ozIUX3sX9de8HmItkiUjbIqCWgJxsudhrAUJ5zEVr1M4BKgH4cj/rj1w== X-Received: by 2002:a5d:42c8:: with SMTP id t8mr111468wrr.1.1543683110911; Sat, 01 Dec 2018 08:51:50 -0800 (PST) MIME-Version: 1.0 X-BeenThere: swupdate@googlegroups.com Received: by 2002:a1c:80c4:: with SMTP id b187ls693192wmd.0.canary-gmail; Sat, 01 Dec 2018 08:51:50 -0800 (PST) X-Received: by 2002:a1c:8850:: with SMTP id k77mr425844wmd.15.1543683110252; Sat, 01 Dec 2018 08:51:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543683110; cv=none; d=google.com; s=arc-20160816; b=QabJfvQ5afOSijHpbrPypACBmemhaaFNP/leX2o4cGr0hetVEE9R5f0M5oZ1dHAtmu jTHgoQ3+C9cdDVKCtqCz4dttsO4hwA8B2p/lrHRVobjm2NeLMAalygUA8FKpvTmgUUf+ IlRLXpokUO72G+R+NHYS6rAfCiZepOhKwfEgU/BukU8xqt6aaiXzl8lhX5l7yGAkFzXq Q+3eVEEu4VT1rJBZWfSNyKkAlDUAw4wNrfo2BkmPyjWnNusldoT1Fx0DPhc1dXUvomJB IzakAe4S/mea7LdTf4hD86umGg0EbFClPLGXv979ZgFnZgAGaF14Fn+jlwXTDzko0FPK od6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:date:subject:cc:to:from; bh=jNah5wd520ry+q5E0ewbzZ//fdNN2ZAbr7isAPAGnRA=; b=q7UCMEXc+KGXyPR+fAZJ7OjG7mxBPzClErwxeBag7qqenJD0V3ykfVZ3Pc9wWRWOq6 VYHEgmcsyWaL0tbGfUq6XdLNDN9mK4ZGZpM/YrhiS7Z7+eAGmu+lbxt825d3ZseBVEUV OWCppBQX8YjJkxTILknd2Y+DL7tmGo0I74G+fxyRPenVX2Y6MiHlRMst21X1CM+qrRz8 sdk5LG+FWt5vUTVo9BudTahqfo9kyWZDg01UhKg185XHD07aAdd1PXhtpyXkgzpVcUYs Y43djjzrc6CUS3ir2u8GOvv58p0Oeghts1XdwKdLD0hNNG7z5POs/xlRqdaWFe/quA/7 oN6w== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=neutral (google.com: 212.18.0.9 is neither permitted nor denied by best guess record for domain of sbabic@denx.de) smtp.mailfrom=sbabic@denx.de Received: from mail-out.m-online.net (mail-out.m-online.net. [212.18.0.9]) by gmr-mx.google.com with ESMTPS id 69si223940wrb.1.2018.12.01.08.51.50 for <swupdate@googlegroups.com> (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 01 Dec 2018 08:51:50 -0800 (PST) Received-SPF: neutral (google.com: 212.18.0.9 is neither permitted nor denied by best guess record for domain of sbabic@denx.de) client-ip=212.18.0.9; Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 436cjf0MLlz1qvvr; Sat, 1 Dec 2018 17:51:50 +0100 (CET) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 436cjf0BFfz1qtdt; Sat, 1 Dec 2018 17:51:50 +0100 (CET) X-Virus-Scanned: amavisd-new at mnet-online.de Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan1.mail.m-online.net [192.168.6.70]) (amavisd-new, port 10024) with ESMTP id KTtJmUrqdWlZ; Sat, 1 Dec 2018 17:51:49 +0100 (CET) Received: from babic.homelinux.org (host-88-217-136-221.customer.m-online.net [88.217.136.221]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPS; Sat, 1 Dec 2018 17:51:49 +0100 (CET) Received: from localhost (mail.babic.homelinux.org [127.0.0.1]) by babic.homelinux.org (Postfix) with ESMTP id B4232454040B; Sat, 1 Dec 2018 17:51:48 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at babic.homelinux.org Received: from babic.homelinux.org ([127.0.0.1]) by localhost (mail.babic.homelinux.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id N9QofKZTg0rS; Sat, 1 Dec 2018 17:51:46 +0100 (CET) Received: from papero.fritz.box (papero.fritz.box [192.168.178.132]) by babic.homelinux.org (Postfix) with ESMTP id 4087245402A9; Sat, 1 Dec 2018 17:51:46 +0100 (CET) From: Stefano Babic <sbabic@denx.de> To: swupdate@googlegroups.com Cc: Stefano Babic <sbabic@denx.de> Subject: [swupdate] [PATCH] handlers: bootloader: let comments and blankline in image Date: Sat, 1 Dec 2018 17:51:44 +0100 Message-Id: <20181201165144.21161-1-sbabic@denx.de> X-Mailer: git-send-email 2.17.1 X-Original-Sender: sbabic@denx.de X-Original-Authentication-Results: gmr-mx.google.com; spf=neutral (google.com: 212.18.0.9 is neither permitted nor denied by best guess record for domain of sbabic@denx.de) smtp.mailfrom=sbabic@denx.de Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list swupdate@googlegroups.com; contact swupdate+owners@googlegroups.com List-ID: <swupdate.googlegroups.com> X-Spam-Checked-In-Group: swupdate@googlegroups.com X-Google-Group-Id: 605343134186 List-Post: <https://groups.google.com/group/swupdate/post>, <mailto:swupdate@googlegroups.com> List-Help: <https://groups.google.com/support/>, <mailto:swupdate+help@googlegroups.com> List-Archive: <https://groups.google.com/group/swupdate List-Subscribe: <https://groups.google.com/group/swupdate/subscribe>, <mailto:swupdate+subscribe@googlegroups.com> List-Unsubscribe: <mailto:googlegroups-manage+605343134186+unsubscribe@googlegroups.com>, <https://groups.google.com/group/swupdate/subscribe> |
Series |
handlers: bootloader: let comments and blankline in image
|
expand
|
diff --git a/handlers/boot_handler.c b/handlers/boot_handler.c index 29fd190..cf41666 100644 --- a/handlers/boot_handler.c +++ b/handlers/boot_handler.c @@ -73,12 +73,28 @@ static int install_boot_environment(struct img_type *img, while (fgets(buf, MAX_BOOT_SCRIPT_LINE_LENGTH, fp)) { char **pair = NULL; unsigned int cnt; + int len = strlen(buf); + + while (len && (buf[len - 1] == '\n' || buf [len - 1] == '\r')) + buf[--len] = '\0'; + + /* Skip comment or empty lines */ + if (len == 0 || buf[0] == '#') + continue; pair = string_split(buf, '='); cnt = count_string_array((const char **)pair); - if (cnt > 0 && strlen(pair[0])) + switch (cnt) { + case 2: + TRACE("name = %s value = %s", pair[0], pair[1]); dict_set_value(img->bootloader, pair[0], pair[1]); + break; + case 1: + TRACE("name = %s Removed", pair[0]); + dict_remove(img->bootloader, pair[0]); + break; + } free(pair); } fclose(fp);
Allow to insert comments (line starting with '#') and blank lines for bootloader images to increase readability. Fix crash when blank lines are part of the image. Signed-off-by: Stefano Babic <sbabic@denx.de> --- handlers/boot_handler.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-)