From patchwork Wed Oct 4 14:01:44 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Babic X-Patchwork-Id: 821324 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::238; helo=mail-wr0-x238.google.com; envelope-from=swupdate+bncbaabbuot2phakgqejbw4o2q@googlegroups.com; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=googlegroups.com header.i=@googlegroups.com header.b="aczgGqwi"; dkim-atps=neutral Received: from mail-wr0-x238.google.com (mail-wr0-x238.google.com [IPv6:2a00:1450:400c:c0c::238]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3y6cyq5qYYz9t16 for ; Thu, 5 Oct 2017 01:01:55 +1100 (AEDT) Received: by mail-wr0-x238.google.com with SMTP id n4sf4170449wrb.8 for ; Wed, 04 Oct 2017 07:01:55 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1507125713; cv=pass; d=google.com; s=arc-20160816; b=v/DyAVa4Ap+VVuOLp9o6+AvzXngMal9/GSvsTICcDRZPMTjO/LS9nnFsOLlzPKs2OS WjcweETZ9Ax8T57o2i6yVc68KiM/7t0b6ZzKmKBCXsc8m0RzkkipmxIw9xvKgIDBQTgA gDo63qodwoD7iTNtEBtEylfVZRuhx0w8z7RXgzZEK+KnX2HyZRebjKQXcNfQwjirmEpC lcZpTPSJMHLymerViGEzP3uKbFPFfpm8kf+fobEMNdIrzdCZMrjHNrEO0n9q6/edhMka hr5fMBvnejAOkFTHJjY/7QezW0o6mRTLbvDAem7XKLYBzIy37Asx0xWoaKmJg+FLjHqy TCqQ== 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=r44EXZPHKvzizsbz2kKw7RrDx+urKCyim9lloHSMEdk=; b=EhfDhUjPEHO/0IqfhcgkF+RW/Jk+NnHx5vTNY+wJebCxeKeSoJ7qn9nbpzDYPsrCps Fg+B26xiixbJNyMrhRSZIrE7fevQa/xunpf7Wvqg/FOG8dkaf4oW+UoEiQygy2kOwCTG gf4oY8XHV9VbqCKHrfYeolNiCwLuFRfwVRdlIdCmGfSL9gseZSE2AVxy/GpMv8cheGI6 0xOH/NrOfJBeJmhr5mYSMQwn2ONdbSGCtSnW9HpjbMF4oWQ0cGimPIiT8uGgBm6jhPLx 6F2kXTX3zmYUEiCGItSPu6X8p8FTDstiOaHa4fvvkMzv0Vy9xgwGRjgzWZ3Qte8X2xWq cTdg== 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=r44EXZPHKvzizsbz2kKw7RrDx+urKCyim9lloHSMEdk=; b=aczgGqwi/F19uwll0Ik4hCf0L02XlxNiBcbSfJLAVron/SBuolxOX6yPGGhibDBD9Y L85ABtvOSQOxmifwnoyRLqkSLILXLBoetJN3SfOx/q1axS+5hIWnKrf9DaAqJIKeqIaJ yzN1wAB3qx2iTGCk+/uecV+b+eee2Rij/RoN7RmqSrI5DX+zKY6OsS4kRUAP5+1NICvg elTmaQlObRiJfuA65HQ1x0/p+nIGRxOA8s6FoueKRz3GPp4TAOOr7L7iyZaHs4PCtyCF SXNnHdaEuZVjDXLM2QHXdrRFrjGw8CdMi1Zn7XRg68rY7gK0v/VdkMDpo3FH/NUzo+IZ lqTw== 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=r44EXZPHKvzizsbz2kKw7RrDx+urKCyim9lloHSMEdk=; b=WklSvGVOhSdmJjIPk/3+vIrXwDif17Q6DgEspDcUo3mWGFqFQyLq/lS0Lr5SwJvoRc FhVa6cqNzeDTPBOh9+zHwc1fZXKxgSIe5cYikx/22SwB3IQBgnSGoNSrQPwDhZ0qA8rX qXExS3NB+pL3jte6wrcBlZv03brlv8dqFniexkL4K/3bBbOtwSa+AnZZJUVBjLhDPDw3 0tz3JpG+LzuVTN/9DOEiCvnS47iykT1jsQkySZZH/NlpC2iP3jD6H1gpomU0h9CN0wXT 0Hx2EYRcFTp9xrrGmA+lO3kJwLvzPS4CeeZfNVR5zWKOQGXtnI6707ECCsXiza2QcITv m5Vg== Sender: swupdate@googlegroups.com X-Gm-Message-State: AMCzsaXGwCXvUr23+TMWAQTvHUQPKgQIKyH8pneCGp3gy/Ul8XsI1W3H SudWRq3IDJGGz4RkSXQpuZ4= X-Google-Smtp-Source: AOwi7QDlY/HZ+X6LwJ2LD9HrY/7KBVUR7TYyjGRqJFeM7QpWEr09m6lPr8Dk9hCicWkGoUW2A6vBYA== X-Received: by 10.28.184.210 with SMTP id i201mr65636wmf.11.1507125713141; Wed, 04 Oct 2017 07:01:53 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: swupdate@googlegroups.com Received: by 10.28.146.131 with SMTP id u125ls3360198wmd.0.gmail; Wed, 04 Oct 2017 07:01:52 -0700 (PDT) X-Received: by 10.28.147.133 with SMTP id v127mr1528970wmd.18.1507125712782; Wed, 04 Oct 2017 07:01:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1507125712; cv=none; d=google.com; s=arc-20160816; b=bzhEqJWrXUIe7M42qF2VvYKoUi9fIpaWiOPH/oxaf/e6wn5Iqs1329LiRtsMi9qOQi cDMsdjoGyvpy8MyT9LoXm67JL8CPUAJlo8rRIsMeVKzxZ06Zna5Hf3clg6s14EK+9+7J Qzh/6FW5RPnFQBcC8vuIMyrSQLjs3zYkswkexo/csrEOHku3/icbH3PiTxX4J0YDDECN vMK3k/eGDG8yCFgrEKWjt94fTW3aV+DjRiWYgsuAeX063QExCLFGJy8yJpmADcxYbvRH PzFJeGuKX6cZYDhAES+smREp7qZxiSkwxxQdnooo70Ypjvo4rQD0Zf5nwCPuYru+NOKj f2Og== 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=0nk8DPfgCv9fbPDTMGr8QyS8P09MJrNG5cpBhvOVi98=; b=IZZ7PSZZO7s3lWPZF2SbvNJFMJGUUAxHKhFIwU4yP4GBF3FORnXGo/uucBK0KWC+Ci 2mVsivtZ6vAWrFnysj75k7wW6ABBnbJNfQ6Kr98Tuwx+7Ev7KZNAnSulsx0niv9lvfS9 wWn2UEpgPRF1BsgVfMhRFS/KuTy7ln3Zt0a8Mz0bz8D6M1YgaCWfPvMAgVwWun6BQyLG aklUKa7DQE4L3OS6q1bQNl1vaYhHu8CFnmuSYp7f8K7Pb1vcX8LOs6xiJtnX7V9wI38C kYuF3RH1bbGvZvZ1+YLRTt4u64A2oiKYRr3Aal1f8E6BJNMbGO62QVxbE8fHzOSXPl8O a3WQ== 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 p200si1986602wmg.4.2017.10.04.07.01.52 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 04 Oct 2017 07:01:52 -0700 (PDT) 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 3y6cym45fLz1qx35; Wed, 4 Oct 2017 16:01:52 +0200 (CEST) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 3y6cym3qNHz1qr44; Wed, 4 Oct 2017 16:01:52 +0200 (CEST) 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 qhmXwBs53h7S; Wed, 4 Oct 2017 16:01:51 +0200 (CEST) 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; Wed, 4 Oct 2017 16:01:51 +0200 (CEST) Received: from localhost (mail.babic.homelinux.org [127.0.0.1]) by babic.homelinux.org (Postfix) with ESMTP id 6FD7145406EC; Wed, 4 Oct 2017 16:01:51 +0200 (CEST) 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 oYojwpRAPXme; Wed, 4 Oct 2017 16:01:48 +0200 (CEST) Received: from papero.fritz.box (papero.fritz.box [192.168.178.132]) by babic.homelinux.org (Postfix) with ESMTP id 1782B45406C5; Wed, 4 Oct 2017 16:01:48 +0200 (CEST) From: Stefano Babic To: swupdate@googlegroups.com Cc: Stefano Babic Subject: [swupdate] [PATCH 2/2] Fix broken path for scripts Date: Wed, 4 Oct 2017 16:01:44 +0200 Message-Id: <1507125704-2423-2-git-send-email-sbabic@denx.de> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1507125704-2423-1-git-send-email-sbabic@denx.de> References: <1507125704-2423-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: , Scripts were moved from TMPDIR to a separate directory, but they are still extracted into TMPDIR if the update is remote. Signed-off-by: Stefano Babic --- corelib/installer.c | 6 +++--- corelib/stream_interface.c | 2 ++ include/installer.h | 1 + 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/corelib/installer.c b/corelib/installer.c index 05a1f5a..9a91c10 100644 --- a/corelib/installer.c +++ b/corelib/installer.c @@ -81,12 +81,12 @@ static int isImageInstalled(struct swver *sw_ver_list, */ int check_if_required(struct imglist *list, struct filehdr *pfdh, struct swver *sw_ver_list, + const char *destdir, struct img_type **pimg) { int skip = SKIP_FILE; struct img_type *img; int img_skip = 0; - const char* TMPDIR = get_tmpdir(); /* * Check that not more as one image wnat to be streamed @@ -116,8 +116,8 @@ int check_if_required(struct imglist *list, struct filehdr *pfdh, if (snprintf(img->extract_file, sizeof(img->extract_file), "%s%s", - TMPDIR, pfdh->filename) >= (int)sizeof(img->extract_file)) { - ERROR("Path too long: %s%s", TMPDIR, pfdh->filename); + destdir, pfdh->filename) >= (int)sizeof(img->extract_file)) { + ERROR("Path too long: %s%s", destdir, pfdh->filename); return -EBADF; } /* diff --git a/corelib/stream_interface.c b/corelib/stream_interface.c index 404c116..988dc09 100644 --- a/corelib/stream_interface.c +++ b/corelib/stream_interface.c @@ -188,6 +188,7 @@ static int extract_files(int fd, struct swupdate_cfg *software) skip = check_if_required(&software->images, &fdh, &software->installed_sw_list, + get_tmpdir(), &img); if (skip == SKIP_FILE) { /* @@ -196,6 +197,7 @@ static int extract_files(int fd, struct swupdate_cfg *software) */ skip = check_if_required(&software->scripts, &fdh, NULL, + get_tmpdirscripts(), &img); } TRACE("Found file:\n\tfilename %s\n\tsize %d %s", diff --git a/include/installer.h b/include/installer.h index 971cc21..4e15f1e 100644 --- a/include/installer.h +++ b/include/installer.h @@ -27,6 +27,7 @@ int check_if_required(struct imglist *list, struct filehdr *pfdh, struct swver *sw_ver_list, + const char *destdir, struct img_type **pimg); int install_images(struct swupdate_cfg *sw, int fdsw, int fromfile); int install_single_image(struct img_type *img);