From patchwork Sun Jan 14 11:45:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Babic X-Patchwork-Id: 860436 Return-Path: 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:400c:c0c::23f; helo=mail-wr0-x23f.google.com; envelope-from=swupdate+bncbcxploxj6ikrbuuf5xjakgqezghec6i@googlegroups.com; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=googlegroups.com header.i=@googlegroups.com header.b="fGz40Esk"; dkim-atps=neutral Received: from mail-wr0-x23f.google.com (mail-wr0-x23f.google.com [IPv6:2a00:1450:400c:c0c::23f]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zKF6G1Tjjz9s9Y for ; Sun, 14 Jan 2018 22:45:25 +1100 (AEDT) Received: by mail-wr0-x23f.google.com with SMTP id n13sf6612393wra.13 for ; Sun, 14 Jan 2018 03:45:25 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1515930323; cv=pass; d=google.com; s=arc-20160816; b=KHtB+hvb/Q5YYcDCFda0qOr4kZekMRZRZrKB61XTJWLf9IUXaAw4xs1FlnRX7VsjM3 AkDuCLB+W6c36ef54JC4GPG+21eKNmbBBG5zp8A8nNnTsg03+0RkyFqFlmKh4Z2BX1SX miiFHLA8hgnjTxeu/ehUb1SvTgMP/zHuztiQj9zoWv3qtkctvLybHNH6pNK+7zhYpyJr zf7x7FY454YK5CU4YuQE4IT3fP5mzG8pjvfawm0nMh5bHufRZgT6HHVm1U53l/tUQ45u 7hAivFNo7/16ICkeBhMQd0yqqSdbNyGBLG8fAyuIY4lhhUz9MVlEXDN3POM1hyQaYXav F4JQ== 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:references:in-reply-to:message-id :date:subject:cc:to:from:arc-authentication-results :arc-message-signature:mime-version:sender:dkim-signature :arc-authentication-results; bh=Wix3ZHqXPzipWqfsUaD16X2RLHplRxEptJMRE2NEcMI=; b=IsuKv4ChL2EUaPX2LT+mzgIisvHODH1EoTNL4T4ZqvAQgj79mZElo79Zxara8dOQBy H/GkExjiQP03u2V68R0wGAZ3ideb4d9/c2Wv6DXcC901mQnJd8JDVcqxqCQ+kp2vNFFh qN7WzjaWSwYGdS4LVQGatLm+2X9IpBJoSuGTubvRHPTcgl0Acq9zNYEFtL/4gIpY3G8L RVUxjEo782XNFVAQJFlpYRbSO5BmikXmH7EGW3BieJJRLAYB00YQBzFyjkHWuinHGc3A TCPBwrAJ6N6IzoNh9y+Yjqh/FU4RhaXaOYBxSCxC0amQRsv/22lgOJ7BQaEYdZiwcLvY leyw== ARC-Authentication-Results: i=2; gmr-mx.google.com; spf=neutral (google.com: 212.18.0.10 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:in-reply-to :references:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-subscribe:list-unsubscribe; bh=Wix3ZHqXPzipWqfsUaD16X2RLHplRxEptJMRE2NEcMI=; b=fGz40EskyAaxgh41Klpxy4asfBwsrmIvj9aeiv/56FpbI5MKK/r/WLcFvs4fTQ8tKY qKT4zrPTjVsONYb6UHe8CgfW4c4T+nsPLGpgPnLfdMeYcVbQ8xwqzlw6Kvwhb/PGExqt QC1wOHh9AXBzY1c9kv/ZGoF8z8eqEYJdT671VmPy2f3MLfnRi9hE/Mduhz01UD25ySGv eRn5izMz04jTa7YLL0R+qt0L7qJ/l8j1eZxvK4D9Z5YfpKCma+kzEx3w//FHGfAhFaSO qeLA9t78ZTq7X8/e8pcidP7zu4BW02ZzDJ88qb5ikXPFyIV1BmHg1LOc9UcIYdMfBRfL UEuA== 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:in-reply-to:references: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=Wix3ZHqXPzipWqfsUaD16X2RLHplRxEptJMRE2NEcMI=; b=svhm4cueS4tZwvcaXCMLWSZdnxj8JbXfuMeFphoZBCwf7FW0s7WPdtS9+OAQ635P4h 0sMlwVvRdihHodNCnvU6Wsnwl9+azfPaKPsuHVQ1hgc6kqZiAueV+PsUwrCWodBQ5FEs Q0QssGX6booTLdYp1VV14xDcEqZjG4MVNE5PL1Tfup+J6rMWIWhYMB5YBvUjLbfArvGX WqyDZ4wsb4oE+D+hQQ0AnlrSirYx6LdjSmePrgdFPxroSS9qCgU6U2fbs+kkrOEpNVKs 823S6r6pF1P9W7BaHaK2uRPfye8LLehvhvJkS/eI8CGnHk5HxoJxFFOeZ531ejl9Mtgi W5iw== Sender: swupdate@googlegroups.com X-Gm-Message-State: AKwxytemFPLUyx+xE8JRW5N43ywY/08S21MLYP3WqMN5aKNYuCg4OelO fqq0zdw0wO+kFlyDX7isbwY= X-Google-Smtp-Source: ACJfBotWa7ugeXM+WFcOIcscNwk9JxF+ThF9DMIYYkm8QE9czHB+euCg/n6JLDyTbZ27Mo4o3h5nVg== X-Received: by 10.28.112.1 with SMTP id l1mr107390wmc.0.1515930323057; Sun, 14 Jan 2018 03:45:23 -0800 (PST) MIME-Version: 1.0 X-BeenThere: swupdate@googlegroups.com Received: by 10.80.182.240 with SMTP id f45ls554743ede.1.gmail; Sun, 14 Jan 2018 03:45:22 -0800 (PST) X-Received: by 10.80.201.193 with SMTP id c1mr2087883edi.9.1515930322275; Sun, 14 Jan 2018 03:45:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515930322; cv=none; d=google.com; s=arc-20160816; b=YJVl/ns+4vagjGiTj26yp4rknYtRENnenArDFYozy31RdzkOsFcDN1QBoq9TuienTN 6XtTco+wMNskKmGKyulfYvZF3JBBgt21sVJWZNmhe9Dzb6ilbhKYBFAhY/lZ6UugdDw9 HNnGrmpdzKpxzPZ0uyfmnIor46XcuBSnsKbPk1kQ6Uv//gzt2MO4Ssbq3F42HRDxSGw2 yhHfZ4EbUSFRB16LV+4r5nRgkL6XGX5uF7m6pvMDyjmoQPQevS65Mw0HW6rnyqAAjBSu N2nplZJjkYvjXvoVt8Ca7So4+sd7n4IQyAvocz99xSAGs29OEME28ipl/8IGFaxAUuhH BiWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=cTx2CQoHb1T3OBcpxgZi6eGx3YbHMkKZs4PcFfgT2Uo=; b=PCGxKhRJWJSqh16N96315Vz4fkPkd1bwqzVITrXekl4+ZAAbAbwlMi+34z+tVGgHds 7ot1HC1PzIp+AiKvdU/O1IqSXYOQoyFBZZ30BBY22tTP0m44A6mbA6WoBUfSPSyQGuHc kixmKCaSIw+TJW6he0/yoFZymmBhgj9L8SJCtA1AsJZEFj58M/tljvxdYAaLrNpgKhyE 12IrTpqmkDAZ4kyJDSaIuGX1HxtplmHO+/ded08d4u8DVi5ZUfStGhUEdf7JVkrXozOI 6gJv1lWrZt/KtlLZH3LNZAZRaGA7PBlxVVoSPn9KRN1OlhGENIcC6v+c1BeGnywQ4lTY n30w== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=neutral (google.com: 212.18.0.10 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.10]) by gmr-mx.google.com with ESMTPS id s29si961630eds.0.2018.01.14.03.45.22 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 14 Jan 2018 03:45:22 -0800 (PST) Received-SPF: neutral (google.com: 212.18.0.10 is neither permitted nor denied by best guess record for domain of sbabic@denx.de) client-ip=212.18.0.10; Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 3zKF696hdNz1qshD; Sun, 14 Jan 2018 12:45:21 +0100 (CET) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 3zKF696WK5z1sFWt; Sun, 14 Jan 2018 12:45:21 +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 hZXJ6DmULusX; Sun, 14 Jan 2018 12:45:21 +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; Sun, 14 Jan 2018 12:45:21 +0100 (CET) Received: from localhost (mail.babic.homelinux.org [127.0.0.1]) by babic.homelinux.org (Postfix) with ESMTP id B4884454052E; Sun, 14 Jan 2018 12:45:20 +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 s3snt0pPDZYE; Sun, 14 Jan 2018 12:45:18 +0100 (CET) Received: from papero.fritz.box (papero.fritz.box [192.168.178.132]) by babic.homelinux.org (Postfix) with ESMTP id 6042E454050F; Sun, 14 Jan 2018 12:45:18 +0100 (CET) From: Stefano Babic To: swupdate@googlegroups.com Cc: Stefano Babic Subject: [swupdate] [PATCH V2 2/2] bootloader handler: fix paths and use TRACE / ERROR macros Date: Sun, 14 Jan 2018 12:45:15 +0100 Message-Id: <1515930315-9438-2-git-send-email-sbabic@denx.de> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1515930315-9438-1-git-send-email-sbabic@denx.de> References: <1515930315-9438-1-git-send-email-sbabic@denx.de> X-Original-Sender: sbabic@denx.de X-Original-Authentication-Results: gmr-mx.google.com; spf=neutral (google.com: 212.18.0.10 is neither permitted nor denied by best guess record for domain of sbabic@denx.de) smtp.mailfrom=sbabic@denx.de Precedence: list Mailing-list: list swupdate@googlegroups.com; contact swupdate+owners@googlegroups.com List-ID: X-Spam-Checked-In-Group: swupdate@googlegroups.com X-Google-Group-Id: 605343134186 List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , Signed-off-by: Stefano Babic --- handlers/boot_handler.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/handlers/boot_handler.c b/handlers/boot_handler.c index 8cda3f6..68c65b4 100644 --- a/handlers/boot_handler.c +++ b/handlers/boot_handler.c @@ -43,30 +43,24 @@ static int install_boot_environment(struct img_type *img, char filename[64]; struct stat statbuf; - const char* TMPDIR = get_tmpdir(); - if (snprintf(filename, sizeof(filename), "%s%s", TMPDIR, + if (snprintf(filename, sizeof(filename), "%s%s", get_tmpdirscripts(), img->fname) >= (int)sizeof(filename)) { - ERROR("Path too long: %s%s", TMPDIR, img->fname); + ERROR("Path too long: %s%s", get_tmpdirscripts(), + img->fname); return -1; } ret = stat(filename, &statbuf); if (ret) { fdout = openfileoutput(filename); - /* - * Bootloader environment is set inside sw-description - * there is no hash but sw-description was already verified - */ ret = copyimage(&fdout, img, NULL); close(fdout); } ret = bootloader_apply_list(filename); - if (ret < 0) { - notify(RUN, RECOVERY_NO_ERROR, ERRORLEVEL, - "Error setting bootloader environment"); + if (ret != 0) { + ERROR("Error setting bootloader environment"); } else { - notify(RUN, RECOVERY_NO_ERROR, INFOLEVEL, - "Bootloader environment updated"); + TRACE("Bootloader environment from %s updated", img->fname); } return ret;