From patchwork Fri Sep 8 13:45:45 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Storm, Christian" X-Patchwork-Id: 811603 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:4010:c07::238; helo=mail-lf0-x238.google.com; envelope-from=swupdate+bncbdd6bwv65qpbbhf7zlgqkgqe3xao3jq@googlegroups.com; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=googlegroups.com header.i=@googlegroups.com header.b="kqFf4kJ4"; dkim-atps=neutral Received: from mail-lf0-x238.google.com (mail-lf0-x238.google.com [IPv6:2a00:1450:4010:c07::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 3xpdv54G2Xz9sBd for ; Fri, 8 Sep 2017 23:48:17 +1000 (AEST) Received: by mail-lf0-x238.google.com with SMTP id 80sf396646lfy.11 for ; Fri, 08 Sep 2017 06:48:17 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1504878493; cv=pass; d=google.com; s=arc-20160816; b=v0awOKM5qUMHUNxLoLxgMIvHNa81443BDtsSDLhfBiTQFy+W90wgxpi2gsOqA+vFGS L3dvJ16q5SuBENuVgcwlSPTuk3guBPRIT0/avs8WpafrXCJmOLeOv6/NO8qSTFpmjGmp vVYVoWWGNcN5GL65eRkawHMHxDs+ap2sVhQHMvdABoMeA/zPahB3F+aNy6W/KBlezPIQ 3mfPS3mC2QhyOCYLPMMzNSwzKK5pjmEFVgvWsP/EirRqYoIIb9l4YoDgysoaLN5EPb0s nxVN8X7dFKukqEOYZ8+jP3zSWLGIj6whADZ2dtn3SCRjdP7Bvdu1CErVSNWRL1vtG5MB tfRg== 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 :arc-authentication-results:arc-message-signature:mime-version :sender:dkim-signature:arc-authentication-results; bh=XYTOuDIjEY5lCx6F4mCaKcdJyEVNX/fcOuorxv0qcSE=; b=jKkWaAjttxKy6V8glfmzcrszdwDGUeLql9k7/sJLDy7ye/fRfn+fT/5E1rPEsf47o9 18AabB62PxkJaW2y/X1wjhkTqMoBqmrfcBzFXS7vwytRKohTEKtzjJi+q0kvxt0bYEJ+ H3kDDrOo9r75HL3UWwYEIdNUmbOld4/+vusgvDphFrHFcxA5r2zUIVLlLedlAfcDOB9K fp35slgXp6eN45OkHSo10WZbjo8x1KvtYRS6C7RR9DNJ3zYhA62srr1k1ZLYPX+TFjfB XAp2LI+ssAtT3J7i2F8hr/8UI6IVolEiwxdhagd8mM2bWpS5T+Yez5tCKbnIupGL4Bhz Lztg== ARC-Authentication-Results: i=2; gmr-mx.google.com; spf=neutral (google.com: 192.35.17.14 is neither permitted nor denied by best guess record for domain of christian.storm@siemens.com) smtp.mailfrom=christian.storm@siemens.com 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=XYTOuDIjEY5lCx6F4mCaKcdJyEVNX/fcOuorxv0qcSE=; b=kqFf4kJ4breis4wf/UnhnSKtwRBRODb1Z8dfwEfIZS8GMAyzPGB0HBUnHlyDse7RZ9 hA/nRBLXEZjhl+WooyHjL9Lvm7OdPbWcFtsMe3PGKHRjphYpyLXtBDKB+m6CN5slnAAB RKPLXARWg3MIIU8ydEURbnUyMMvHP9WfutEBN4uoMS1jc8EXyYuiM/24x2hLqcyUlbwD zI3KJSC7a0SgE7WFr5WrEPe8QCflibNrQsgkTMf1FzUaLiwI5objWpCTI0rsKFJeCJZV 1iCV3KCNxex/sLmG2Z//B1seVuIjvVLXiC5ukD/WMYH39t90XSyUTehpv4uzQRhLjMoJ QdCg== 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=XYTOuDIjEY5lCx6F4mCaKcdJyEVNX/fcOuorxv0qcSE=; b=Fqg0idjUXcv0O792Ew7R8A9SQJxhd/WO0/b2jRToWz+sRflXtha97jFRFEJK8EzgUm nOsqubqyGf0krWNB+OUgFzr4JLlNTxjAsHfS8rm3vW6mZ0ce9kW0MoiNsqCGJnkIKsLI lrWktckQHRUHc1A27MJQ1T0PdSRwcDymfZDC3aP18mQd+OmNcxJjq4s69ZpKf+AVeOPR PCLAkGL9pIDnd8VgOa2ZkM0jwQ7IQ9QG+MBOpJGfUUTN1E9rvJBMVi6Cns4+0ylhVYd3 uxuGH4g7Ribajs6BvcOHIXA5C7LrijqKesgmAU3GpZStCr4wmKyO6JyQl1huUW2j4KQe amPg== Sender: swupdate@googlegroups.com X-Gm-Message-State: AHPjjUhi/N7KM/1pc9Adyag+etfArgFIaTO8LtNARukCGYh3zTMumcOV 0w/kcT65LYGdzA== X-Google-Smtp-Source: AOwi7QBRlIXZcHsQGJPnBAUctnyp/p86sBqxcze1vmoLYyR1sA/E2P9KeYaT2vzSvkZODSxwyCwHZQ== X-Received: by 10.46.22.9 with SMTP id w9mr4973ljd.9.1504878492979; Fri, 08 Sep 2017 06:48:12 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: swupdate@googlegroups.com Received: by 10.25.166.8 with SMTP id p8ls17309lfe.23.gmail; Fri, 08 Sep 2017 06:48:12 -0700 (PDT) X-Received: by 10.46.86.74 with SMTP id k71mr240771ljb.0.1504878492530; Fri, 08 Sep 2017 06:48:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1504878492; cv=none; d=google.com; s=arc-20160816; b=L03+37vtEYaq/GO4wYVloYgcS4LzjEmNLygPHth14Mt3YYsnogVSC/Xm44L/yAOTXv SrYCHuGY+JxsMJpelIWakMsCkG4RiU9y52Plw7XMkuiLvFOLpvpggXbQIkn/dHtuqye3 apcjjF7acLXaWJytDjGmPtCr56uBlB6OUYSqs6iRzfFnIs/4NRx0lsvfkFK4FqmkS71+ aAI6O5E60+VeKKP0p+kuGWWvHLJZreG22YWidGgIiKkI3C1AYzUAmg4TObBLNDS5WlxN RC7+hMQP6yYWReAp0Jk/gjgTHbmaK728alGytWv5p0b6lg2kR3TaWjjck6PksdGt4qry IyoQ== 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:arc-authentication-results; bh=POesLmUtky4nmGZMdwD7wEtIaooRKPOUQKGOZiqDdUA=; b=H3CGYoUmn9Hw/4uP7V/RDSS3Dp8rhWg8ZfBxHqA/RTO6u0g71qz45X3wZTsecucHSJ AXosnz52va6GeVld94mukvjFWxz5Ie1grqgD62Aod7AYgxQVtIKZ59Al9BKPZT79tC+b j3E/qtsh2R9l2D1+wqMYZ5G+kYHBVNz0UXdZb3yitVsqIwbx9T2z8HB03Oe88JA7QcT9 q4UWiFxiL0UvcVeXLDDOKXAtZrUJZdvHwEo2KuGY5rwS8e0DgI7lqVQHGiAE71l4OQc1 IOpILfTqh3uaPs4zLFxWYiLW6w6sQ9KKT/T0lIJUbnyRykh+E0z2yOmj6Z2zREOCRCus wS+g== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=neutral (google.com: 192.35.17.14 is neither permitted nor denied by best guess record for domain of christian.storm@siemens.com) smtp.mailfrom=christian.storm@siemens.com Received: from david.siemens.de (david.siemens.de. [192.35.17.14]) by gmr-mx.google.com with ESMTPS id 200si286505wmj.0.2017.09.08.06.48.12 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 08 Sep 2017 06:48:12 -0700 (PDT) Received-SPF: neutral (google.com: 192.35.17.14 is neither permitted nor denied by best guess record for domain of christian.storm@siemens.com) client-ip=192.35.17.14; Received: from mail2.siemens.de (mail2.siemens.de [139.25.208.11]) by david.siemens.de (8.15.2/8.15.2) with ESMTPS id v88DmCE4000486 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Fri, 8 Sep 2017 15:48:12 +0200 Received: from MD1KR9XC.ad001.siemens.net ([139.25.69.251]) by mail2.siemens.de (8.15.2/8.15.2) with ESMTP id v88DmBKk021896; Fri, 8 Sep 2017 15:48:11 +0200 From: Christian Storm To: swupdate@googlegroups.com Cc: Christian Storm Subject: [swupdate] [PATCH 1/3] tmpdir: introduce get_tmpdir() respecting TMPDIR Date: Fri, 8 Sep 2017 15:45:45 +0200 Message-Id: <20170908134547.9170-1-christian.storm@siemens.com> X-Mailer: git-send-email 2.14.1 X-Original-Sender: christian.storm@siemens.com X-Original-Authentication-Results: gmr-mx.google.com; spf=neutral (google.com: 192.35.17.14 is neither permitted nor denied by best guess record for domain of christian.storm@siemens.com) smtp.mailfrom=christian.storm@siemens.com 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: , Introduce a get_tmpdir() method that is to be used instead of the #define'd TMPDIR hard-coded to /tmp so that SWUpdate respects the TMPDIR environment variable or, if it is unset, falls back to /tmp as sane default and current behavior. Signed-off-by: Christian Storm --- core/util.c | 23 +++++++++++++++++++++++ include/util.h | 2 +- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/core/util.c b/core/util.c index b714f29..fe2a657 100644 --- a/core/util.c +++ b/core/util.c @@ -52,6 +52,29 @@ char *sdup(const char *str) { return p; } +static char* TMPDIR = NULL; + +const char* get_tmpdir(void) +{ + if (TMPDIR != NULL) { + return TMPDIR; + } + + char *env_tmpdir = getenv("TMPDIR"); + if (env_tmpdir == NULL) { + TMPDIR = (char*)"/tmp/"; + return TMPDIR; + } + + if (env_tmpdir[strlen(env_tmpdir)] == '/') { + TMPDIR = env_tmpdir; + return TMPDIR; + } + + asprintf(&TMPDIR, "%s/", env_tmpdir); + return TMPDIR; +} + static int countargc(char *args, char **argv) { int count = 0; diff --git a/include/util.h b/include/util.h index 70a0acc..9fb7860 100644 --- a/include/util.h +++ b/include/util.h @@ -112,7 +112,6 @@ typedef void (*notifier) (RECOVERY_STATUS status, int level, const char *msg); #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0])) -#define TMPDIR "/tmp/" #define LG_16 4 #define FROM_HEX(f) from_ascii (f, sizeof f, LG_16) @@ -196,5 +195,6 @@ static inline int decompress_image(int __attribute__ ((__unused__))infile, } #endif +const char* get_tmpdir(void); #endif From patchwork Fri Sep 8 13:45:46 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Storm, Christian" X-Patchwork-Id: 811602 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+bncbdd6bwv65qpbbhn7zlgqkgqeg5vjfyy@googlegroups.com; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=googlegroups.com header.i=@googlegroups.com header.b="b9B0H6du"; 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 3xpdv52v5sz9sBZ for ; Fri, 8 Sep 2017 23:48:17 +1000 (AEST) Received: by mail-wr0-x23f.google.com with SMTP id d6sf244771wrd.9 for ; Fri, 08 Sep 2017 06:48:17 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1504878493; cv=pass; d=google.com; s=arc-20160816; b=X8RIjNhc9ifRzj8BJ9kBex/+ZVT/s2/FYhY0mMjztdLIAO+BCoK/06jfy3yFJmEKO/ krgBxek0Amw946luKLy/onNWI/RTn9e8B6j4le+hUeSxuY6u5HuLdCU5gNkm8Fvwcw2h 4KPE5xjj4sVDiLd8/1IzOWL5/+RJClS6pe81hSea7sz0tPwEehRfPLZxtrM3Wy09qboN 8ZNJfvcygtJNs4OS2mjANxU55llEIUn6un1OkPHf2zDUC87XzM+z8Y/La4P8NgAeSugM laG74KySbkH4aoFAgkoNOi6A0gTK0fQuEfqYcYbgyMUMi972tEx+4jjQcpNm7oAlA/GK jumg== 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=oA1qkDWx+lFgdoPrQhIMRME4WHoJcT+0EQzYnP5b42M=; b=eoTGMCVFxRLSZxpC22cwFFDVKhizAPzmYDL5zCh3EesK2Chpbey9o5zZMBXJRY3gyn gG32rvG456P9dVoRfsJGAXwttEjgG0sMjZp4GgEz22zV9HUIIOY2QzXX5bf+3LjUwXQ5 5cYaHgAf8EjFyjh7iuI9eEDUqpBVoKXxwt9EnOy2CjpAmvwJycXheqHXwTA6qXHMd1UR dT/hDEV7KPakVZ4FdMWJt9b+KMH+KJQ8Qo7I6N1LOSw4MKW6VxEG9unlSooYQOPlHDuE 0lsjxpqS6wQVdt6oEJvh2p+xloSRj9q4ooTa0kycHGPopoK7U+n0orj7fjPaUHi1IHXg K0XA== ARC-Authentication-Results: i=2; gmr-mx.google.com; spf=neutral (google.com: 192.35.17.14 is neither permitted nor denied by best guess record for domain of christian.storm@siemens.com) smtp.mailfrom=christian.storm@siemens.com 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=oA1qkDWx+lFgdoPrQhIMRME4WHoJcT+0EQzYnP5b42M=; b=b9B0H6dugpPf0//SBeZeLIn4Ornqy3uFO1tHbkvzVo0hMyHI1SjYsbgwYALOHFGGUL KOtq79ZpNorDqj8rF9uT7E9ZRhSdwYPGebQmTZL9f2GQaf7crLfGEG9uMTv4u7LmByHv c8jkJ4GmFVcaPtvmOmRqLFCpvMO3KUk0cbMzT3As3pFTzy+oMJrUTfQLL1LpBh/sNTzK 9sHz89vWvtcCmRbukQ95kTTC/Ngtcs/fNnnyBy5KodulRSJ8UE6NgUL8I5Hm95031XS4 xUUwghjobcdjh8Xv/9FbuFAGMTiM/Y+Hi7Fo5y7I7aZbQccxThXSYdItHOFOwM0UWXhw EzhQ== 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=oA1qkDWx+lFgdoPrQhIMRME4WHoJcT+0EQzYnP5b42M=; b=ul0RXGV28FfDfoYhIC+lEeJJJ/9MajWIwhB7IgtjaS0Vow1vsThOft2wJxlwAGun1y ILpeC86kWocxIcIKCJLcuPOklA0MDCbpPkMHdgOFJzCo53arTTLytNGevYe78ACyiEKh ucSWjGa6PDEIAEWG3tB19rpiQInYkhSCtQNn/XRmIuNhB/5THSntxnu9E4LHjHnfeg1C rc5fW4252jEKlUzMbmT67dDnfDiUO/HHJlSLAzqt5VwUPeO7vll7GJ/YGSoFN3IBLQmF VuHfzYqEkAX0cNjc8Blhm220UygO1+CJYEOn8YwfVMbo2wi5umrWMp5mpXOeu0iTgOsL rkPg== Sender: swupdate@googlegroups.com X-Gm-Message-State: AHPjjUiGbeKmsdnEA2xlr7cLUZsqLa+v+J7EZW7jx/uUj7XJRX62JMDP iLKyqT7B4A3JONSeH05S3mg= X-Google-Smtp-Source: AOwi7QBPnRSw2FxaQrJ4MNWExq+0kDvQK1NCJpQIv06o4Y+JIcMUiRWCLoKY1IDGDHACI1jRUDtGTQ== X-Received: by 10.28.148.73 with SMTP id w70mr7889wmd.2.1504878493443; Fri, 08 Sep 2017 06:48:13 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: swupdate@googlegroups.com Received: by 10.28.168.81 with SMTP id r78ls33492wme.27.gmail; Fri, 08 Sep 2017 06:48:13 -0700 (PDT) X-Received: by 10.28.4.69 with SMTP id 66mr212298wme.25.1504878493018; Fri, 08 Sep 2017 06:48:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1504878492; cv=none; d=google.com; s=arc-20160816; b=mlt/tSar1zFF1/pcNf5CjoXYv82pHVytlpQpn4UoAoGyWSu1vyj5049osSfmfxdf0L fsEs/BWxj9CsM5OPjPIyfiWp2OhSbU7Y9wGego+ww/DXN5VExn+3bMaJPypFCLLK02Df SZB5bdojiTXXqV7urzggwc3kypY13FAra2BgfiUfhMCBaE6CIhkmoaqHT6vravP4KNx7 uBLgPadxWksHqlZYzeN7qThUjUZNlblwYNO2tEGcSwx001YuVtI1/BmUh8qGw8Ht2PJD tSHAhb9i3KqQAuWssmd4PU8aVOhkog8/Y9kzDByd5HC4CAgEgFUep5hylwXPNNapGO6X kV3g== 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=KHOxVtfw0Lz2nNF7ajnrSBSfgmQ8w1wUttPebtnGVW0=; b=LOBuxym0spyT4l6WSC6kVp1xMPXJL9FvbpIBsw5PavYsROzo7h2f6vm4rOVIzWolgO 2jmnRRv0STUhRx3Iom5DNmAmb8fRLzQI/tWDEFbkGnySYcB+7CXK4UCnTJ2PNdljC1sC CVqHFvlqjydynSO+aEdnk5zvWq8Z2HflZz/NmARm2wdAP8w+IkMs/ENa48ljZSNmCBNC LlhLUFBErHQdp6xGRmw3pH6kVHy2NufBtPpDsUl95Aek9Vhdczpz8jf23flEp5GooDFl OaliFoVSfz2185S5D/d3qwAxSJQUWrWCzMzzlvuBjFsD9CdTIcKi3JU8cYb7LkXczmbA gzQw== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=neutral (google.com: 192.35.17.14 is neither permitted nor denied by best guess record for domain of christian.storm@siemens.com) smtp.mailfrom=christian.storm@siemens.com Received: from david.siemens.de (david.siemens.de. [192.35.17.14]) by gmr-mx.google.com with ESMTPS id r8si190734wma.4.2017.09.08.06.48.12 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 08 Sep 2017 06:48:12 -0700 (PDT) Received-SPF: neutral (google.com: 192.35.17.14 is neither permitted nor denied by best guess record for domain of christian.storm@siemens.com) client-ip=192.35.17.14; Received: from mail2.siemens.de (mail2.siemens.de [139.25.208.11]) by david.siemens.de (8.15.2/8.15.2) with ESMTPS id v88DmCUP000489 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Fri, 8 Sep 2017 15:48:12 +0200 Received: from MD1KR9XC.ad001.siemens.net ([139.25.69.251]) by mail2.siemens.de (8.15.2/8.15.2) with ESMTP id v88DmBKl021896; Fri, 8 Sep 2017 15:48:12 +0200 From: Christian Storm To: swupdate@googlegroups.com Cc: Christian Storm Subject: [swupdate] [PATCH 2/3] tmpdir: make use of get_tmpdir() Date: Fri, 8 Sep 2017 15:45:46 +0200 Message-Id: <20170908134547.9170-2-christian.storm@siemens.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20170908134547.9170-1-christian.storm@siemens.com> References: <20170908134547.9170-1-christian.storm@siemens.com> X-Original-Sender: christian.storm@siemens.com X-Original-Authentication-Results: gmr-mx.google.com; spf=neutral (google.com: 192.35.17.14 is neither permitted nor denied by best guess record for domain of christian.storm@siemens.com) smtp.mailfrom=christian.storm@siemens.com 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: , Adapt the usages of former #define'd TMPDIR to make use of get_tmpdir() instead. Signed-off-by: Christian Storm --- core/cpio_utils.c | 1 + core/swupdate.c | 16 ++++++++++++---- corelib/installer.c | 11 +++++++++-- corelib/stream_interface.c | 3 ++- handlers/archive_handler.c | 9 ++++++++- handlers/boot_handler.c | 1 + handlers/raw_handler.c | 2 ++ handlers/shell_scripthandler.c | 10 ++++++---- include/globals.h | 8 ++++---- 9 files changed, 45 insertions(+), 16 deletions(-) diff --git a/core/cpio_utils.c b/core/cpio_utils.c index c3df86f..e8651a3 100644 --- a/core/cpio_utils.c +++ b/core/cpio_utils.c @@ -342,6 +342,7 @@ off_t extract_sw_description(int fd, const char *descfile, off_t start) char output_file[64]; uint32_t checksum; int fdout; + const char* TMPDIR = get_tmpdir(); if (extract_cpio_header(fd, &fdh, &offset)) { ERROR("CPIO Header wrong\n"); diff --git a/core/swupdate.c b/core/swupdate.c index 1f0ba0d..3057000 100644 --- a/core/swupdate.c +++ b/core/swupdate.c @@ -305,7 +305,9 @@ static int install_from_file(char *fname, int check) pos); #endif - ret = parse(&swcfg, TMPDIR SW_DESCRIPTION_FILENAME); + char* swdescfilename = alloca(strlen(get_tmpdir())+strlen(SW_DESCRIPTION_FILENAME)+1); + sprintf(swdescfilename, "%s%s", get_tmpdir(), SW_DESCRIPTION_FILENAME); + ret = parse(&swcfg, swdescfilename); if (ret) { ERROR("failed to parse " SW_DESCRIPTION_FILENAME "!\n"); exit(1); @@ -394,6 +396,12 @@ static int parse_image_selector(const char *selector, struct swupdate_cfg *sw) return 0; } +static void create_directory(const char* path) { + char* dpath = alloca(strlen(get_tmpdir())+strlen(path)+1); + sprintf(dpath, "%s%s", get_tmpdir(), path); + mkdir(dpath, 0777); +} + static void swupdate_init(struct swupdate_cfg *sw) { /* Initialize internal tree to store configuration */ @@ -407,9 +415,9 @@ static void swupdate_init(struct swupdate_cfg *sw) /* Create directories for scripts */ - mkdir(SCRIPTS_DIR, 0777); - mkdir(DATASRC_DIR, 0777); - mkdir(DATADST_DIR, 0777); + create_directory(SCRIPTS_DIR_SUFFIX); + create_directory(DATASRC_DIR_SUFFIX); + create_directory(DATADST_DIR_SUFFIX); #ifdef CONFIG_MTD mtd_init(); diff --git a/corelib/installer.c b/corelib/installer.c index ad0e0f1..8a188a1 100644 --- a/corelib/installer.c +++ b/corelib/installer.c @@ -86,6 +86,7 @@ int check_if_required(struct imglist *list, struct filehdr *pfdh, 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 @@ -204,7 +205,9 @@ static int update_bootloader_env(void) int ret = 0; TRACE("Updating bootloader environment"); - ret = bootloader_apply_list((char *)BOOT_SCRIPT); + char* bootscript = alloca(strlen(get_tmpdir())+strlen(BOOT_SCRIPT_SUFFIX)+1); + sprintf(bootscript, "%s%s", get_tmpdir(), BOOT_SCRIPT_SUFFIX); + ret = bootloader_apply_list(bootscript); if (ret < 0) ERROR("Error updating bootloader environment"); @@ -250,6 +253,7 @@ int install_images(struct swupdate_cfg *sw, int fdsw, int fromfile) char filename[64]; struct filehdr fdh; struct stat buf; + const char* TMPDIR = get_tmpdir(); /* Extract all scripts, preinstall scripts must be run now */ if (fromfile) { @@ -268,7 +272,9 @@ int install_images(struct swupdate_cfg *sw, int fdsw, int fromfile) } /* Update u-boot environment */ - ret = prepare_boot_script(sw, BOOT_SCRIPT); + char* bootscript = alloca(strlen(TMPDIR)+strlen(BOOT_SCRIPT_SUFFIX)+1); + sprintf(bootscript, "%s%s", TMPDIR, BOOT_SCRIPT_SUFFIX); + ret = prepare_boot_script(sw, bootscript); if (ret) { return ret; } @@ -377,6 +383,7 @@ void cleanup_files(struct swupdate_cfg *software) { struct img_type *img; struct dict_entry *bootvar; struct hw_type *hw; + const char* TMPDIR = get_tmpdir(); LIST_FOREACH(img, &software->images, next) { if (img->fname[0]) { diff --git a/corelib/stream_interface.c b/corelib/stream_interface.c index 30e99ce..fb56c96 100644 --- a/corelib/stream_interface.c +++ b/corelib/stream_interface.c @@ -89,6 +89,7 @@ static int extract_file_to_tmp(int fd, const char *fname, unsigned long *poffs) struct filehdr fdh; int fdout; uint32_t checksum; + const char* TMPDIR = get_tmpdir(); if (extract_cpio_header(fd, &fdh, poffs)) { return -1; @@ -135,7 +136,7 @@ static int extract_files(int fd, struct swupdate_cfg *software) int fdout; struct img_type *img, *part; char output_file[MAX_IMAGE_FNAME]; - + const char* TMPDIR = get_tmpdir(); /* preset the info about the install parts */ diff --git a/handlers/archive_handler.c b/handlers/archive_handler.c index 0568a41..f86d1f2 100644 --- a/handlers/archive_handler.c +++ b/handlers/archive_handler.c @@ -34,7 +34,7 @@ #include "handler.h" #include "util.h" -#define FIFO TMPDIR "archivfifo" +#define FIFO_FILE_NAME "archivfifo" /* Just to turn on during development */ static int debug = 0; @@ -103,6 +103,8 @@ extract(void *p) * Enabling bzip2 is more expensive because the libbz2 library * isn't very well factored. */ + char* FIFO = alloca(strlen(get_tmpdir())+strlen(FIFO_FILE_NAME)+1); + sprintf(FIFO, "%s%s", get_tmpdir(), FIFO_FILE_NAME); if ((r = archive_read_open_filename(a, FIFO, 4096))) { ERROR("archive_read_open_filename(): %s %d\n", archive_error_string(a), r); @@ -154,6 +156,9 @@ static int install_archive_image(struct img_type *img, void *status; int use_mount = (strlen(img->device) && strlen(img->filesystem)) ? 1 : 0; + char* DATADST_DIR = alloca(strlen(get_tmpdir())+strlen(DATADST_DIR_SUFFIX)+1); + sprintf(DATADST_DIR, "%s%s", get_tmpdir(), DATADST_DIR_SUFFIX); + pthread_attr_init(&attr); pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE); @@ -182,6 +187,8 @@ static int install_archive_image(struct img_type *img, } } + char* FIFO = alloca(strlen(get_tmpdir())+strlen(FIFO_FILE_NAME)+1); + sprintf(FIFO, "%s%s", get_tmpdir(), FIFO_FILE_NAME); unlink(FIFO); ret = mkfifo(FIFO, 0666); if (ret) { diff --git a/handlers/boot_handler.c b/handlers/boot_handler.c index f2d4aaf..41f87f7 100644 --- a/handlers/boot_handler.c +++ b/handlers/boot_handler.c @@ -44,6 +44,7 @@ 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, img->fname) >= (int)sizeof(filename)) { ERROR("Path too long: %s%s", TMPDIR, img->fname); diff --git a/handlers/raw_handler.c b/handlers/raw_handler.c index 4b567fb..91e9bb7 100644 --- a/handlers/raw_handler.c +++ b/handlers/raw_handler.c @@ -59,6 +59,8 @@ static int install_raw_file(struct img_type *img, int fdout; int ret = 0; int use_mount = (strlen(img->device) && strlen(img->filesystem)) ? 1 : 0; + char* DATADST_DIR = alloca(strlen(get_tmpdir())+strlen(DATADST_DIR_SUFFIX)+1); + sprintf(DATADST_DIR, "%s%s", get_tmpdir(), DATADST_DIR_SUFFIX); if (strlen(img->path) == 0) { ERROR("Missing path attribute"); diff --git a/handlers/shell_scripthandler.c b/handlers/shell_scripthandler.c index adda3ad..9095a5f 100644 --- a/handlers/shell_scripthandler.c +++ b/handlers/shell_scripthandler.c @@ -40,17 +40,19 @@ static void shell_postinstall_handler(void); static int execute_shell_script(struct img_type *img, const char *fnname) { int ret; - char shellscript[MAX_IMAGE_FNAME + - strlen(SCRIPTS_DIR) + strlen("postinst") + 2]; + const char* TMPDIR = get_tmpdir(); + + char shellscript[MAX_IMAGE_FNAME + strlen(TMPDIR) + + strlen(SCRIPTS_DIR_SUFFIX) + strlen("postinst") + 2]; snprintf(shellscript, sizeof(shellscript), - "%s%s", TMPDIR, img->fname); + "%s%s%s", TMPDIR, SCRIPTS_DIR_SUFFIX, img->fname); if (chmod(shellscript, S_IRUSR | S_IWUSR | S_IXUSR)) { ERROR("Execution bit cannot be set for %s", shellscript); return -1; } snprintf(shellscript, sizeof(shellscript), - "%s%s %s", TMPDIR, img->fname, fnname); + "%s%s%s %s", TMPDIR, SCRIPTS_DIR_SUFFIX, img->fname, fnname); ret = system(shellscript); if (WIFEXITED(ret)) { diff --git a/include/globals.h b/include/globals.h index 9e0c2b9..6e87839 100644 --- a/include/globals.h +++ b/include/globals.h @@ -34,10 +34,10 @@ #define MAX_SEEK_STRING_SIZE 32 /* These are fixed path to temporary files */ -#define SCRIPTS_DIR TMPDIR "scripts/" -#define DATASRC_DIR TMPDIR "datasrc/" -#define DATADST_DIR TMPDIR "datadst/" -#define BOOT_SCRIPT TMPDIR "boot-script" +#define SCRIPTS_DIR_SUFFIX "scripts/" +#define DATASRC_DIR_SUFFIX "datasrc/" +#define DATADST_DIR_SUFFIX "datadst/" +#define BOOT_SCRIPT_SUFFIX "boot-script" #endif From patchwork Fri Sep 8 13:45:47 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Storm, Christian" X-Patchwork-Id: 811601 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:4010:c07::239; helo=mail-lf0-x239.google.com; envelope-from=swupdate+bncbdd6bwv65qpbbhf7zlgqkgqe3xao3jq@googlegroups.com; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=googlegroups.com header.i=@googlegroups.com header.b="pPVX61VG"; dkim-atps=neutral Received: from mail-lf0-x239.google.com (mail-lf0-x239.google.com [IPv6:2a00:1450:4010:c07::239]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3xpdv43B4Gz9s8J for ; Fri, 8 Sep 2017 23:48:15 +1000 (AEST) Received: by mail-lf0-x239.google.com with SMTP id c8sf392823lfe.21 for ; Fri, 08 Sep 2017 06:48:15 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1504878493; cv=pass; d=google.com; s=arc-20160816; b=j3z8K6OnVUtkP5Tn788qgiolToakG0iWilwbGJAbgcT9ATBks8LXfn3Ki3RdKQVKod wc/geGtCQpUjnoGo5ez1hp65ffU054ZupPuSDAG8rFv8TmoX21cdnyRuNB5mNVj55WMz Y83ydiTZ7SjuwqFyytj+f+v8pivwAIxQsd5bHAzknlr8WX/zwpGX4BAqi+XK0T0JZTu6 fy1p0DLobK0g3LvL124cYdyHY9ss+N/+SAWaWkR54MfYKCuUZw43DhVNTxX5eQVZE6Lo txrtU033M1N5ecEuK0yVtDv0eRpJ8ezTfEiW8mD9S9HbajduAt54w4a9M5ATA2fnrVbg wmHg== 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=YcquJXh+ohJrXxDVSXgIqY4s+tLwHUQOaUWmduQEBGM=; b=EsT/FDCn8qLN+55C66cZI/2QMffxVkRSut9dekXS1hcDVc8p0H5ynqUUuPUxiIg0lf /kGOKqzvvRHQczEevXUjoLxBEaDnaF5zXzsDM3pyxnQETd6t4+0Bm7scmxbUlifCk/nq I+X5i0fyce89FMpHtwoL8YhncMU8jHyQvyb4iKPOVs4B7+33J1ibW9MR1wN1tAuHl24R JaRqDti7uf+gQBaMeZWyCgGOsQPGHI9H0XgVG7eGfRSaMgk5Tq8zdBMpIExzaH9yctuo e2FpmKpRggdmJCsaoBQtKe1VnBHCVjW/W06uNNvlS+OnX4agyceKeUvnxVt+aakGRtRc 6mYg== ARC-Authentication-Results: i=2; gmr-mx.google.com; spf=neutral (google.com: 192.35.17.2 is neither permitted nor denied by best guess record for domain of christian.storm@siemens.com) smtp.mailfrom=christian.storm@siemens.com 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=YcquJXh+ohJrXxDVSXgIqY4s+tLwHUQOaUWmduQEBGM=; b=pPVX61VGD9RJKVpupXNCdzSUtYxw0d+m72mqx1CkJfg6bjWmmdNmpvi6vOB4NRDaQs Kf/Rv0cdF1LF+Ir9r54kZcXmlI1J+v434VGkrDz3ZYm2L5WJYLmJ3Q9P3pEBmhFoUly7 +I1MHMt+0tMwI3nJj170SM2L1TjDJ6ddXCRQ1jPsqkmSpYnnq5T965RW3VhcZ8QoxA7m XI8EdVamvaSpihTvqqSUG/QeIfX7YGoK5Joo54cvkhIpQOiueKyL96TfAoT0/FYzgKE+ aBQLo15OJgJxIEqqHUucg5OlB3yxOaSUeFoEJlf1DbEbjNVRRYunSVoxFL0A5jwuT2DX 37MQ== 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=YcquJXh+ohJrXxDVSXgIqY4s+tLwHUQOaUWmduQEBGM=; b=Mpnu3Mya/ncGmUn7HTsImLxtmOrbAqsOPSJK/9n1Y/jiKswtPk/tbIIJuwnR1UtoaM Uz6S8/cRbjPsvoB2HB5U3Gd1fj5FCViCwDrJeR1aRmxns+vjXSELLMPGKh53ek2jQYZB t7ULE2iETd7sww+diI97j0QZcIsDRt0DLp8zStKVqWgFI9BSjFRPk+EYv3N0cvTRwTB9 WtehVcKsJZZyuG0pUaV4QCrzL9EFOTuCbUNRfICs2Li3GrZxhmke78V9h+Mg8iP8uv5S yOnkEqeXyxb1yPBFw1Ejc21CSn6YpBWi1RnU5eHOWbPxde9nVxsHQQv09QRWR7tWN6kC Oa+g== Sender: swupdate@googlegroups.com X-Gm-Message-State: AHPjjUgTD1so9dtZ5b3C5glRG292rLa+Xa2VMSzLwq9cg1kflrMTMD6H IlDDZaj83QgLhw== X-Google-Smtp-Source: AOwi7QCbsjF9cMwlSCyKNoGc2WDTqzOKGCLVAG71E2n6hk8kRykBarcK+KKYa3nOA1u+MdqKSPMKUQ== X-Received: by 10.46.21.92 with SMTP id 28mr5338ljv.5.1504878493101; Fri, 08 Sep 2017 06:48:13 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: swupdate@googlegroups.com Received: by 10.25.198.16 with SMTP id w16ls17441lff.24.gmail; Fri, 08 Sep 2017 06:48:12 -0700 (PDT) X-Received: by 10.25.216.209 with SMTP id r78mr228887lfi.43.1504878492463; Fri, 08 Sep 2017 06:48:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1504878492; cv=none; d=google.com; s=arc-20160816; b=vPiwgT8G24/eFZJRatIBCGGJPXOSX+9CZPwUBkhC7ov3CG48/bAOXM7wENRZEqqoGQ G+0og3/KQabgxWrqjiXBt1JApeyViR+OFOuV0hdterLECS/syksLTxWKAvO0XwCK4fh4 YfUmDKuFSYPu/oZ26jfl9TxJZYhn5HgoSMg8o3t2kfy3V5Ls5mt3EwXl9z63bhQDwl3G 3mXUrkFf0s3KgHupv2ANTnH/a5rbe543KFeMggDquUHy2I/RN696iC36A7LgaXHeGHrE pwa1rz5gGU0tW1B36MnpruHwigrejtH2Quw7Bygd9K00FclR3SuKuQ8MDspeFU/ZaKVX wUhw== 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=NWJK241U4wyLZA0EF4du8nCYS5VA325UY2tOAApRkQ8=; b=d5Gnx8pP5uCyqbP/00jG0MzbB22ah+q+p7RPHpfzZXl3MEJJdLirq+aWBU1IeKslzB gDs/96foU0DpkqOLIO7+BxJTDxaTIwSQNOtX2lEUCTUX9rHWuEkKv59M2rAP4AnQq7MK Z0IuCon4Pwy4l8WvjVwAfGS8bD1PyIvgSJq1wkqtlO1yaugyfKyD+vR6lPuOS3iztEm3 gkHoT58heZdcEmCKNYh/LosPOtAL/Y2SHrSd2p4Uafaox3wlScwBY9eD6Z6ZOm9CMnso k9xcKyCc3GzPP3y1dwThgB4bVrLopXcVxNVr5N1bPLvw3U7DenUY2pT0NPAVAXbgEPTh bg/A== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=neutral (google.com: 192.35.17.2 is neither permitted nor denied by best guess record for domain of christian.storm@siemens.com) smtp.mailfrom=christian.storm@siemens.com Received: from thoth.sbs.de (thoth.sbs.de. [192.35.17.2]) by gmr-mx.google.com with ESMTPS id r8si190730wma.4.2017.09.08.06.48.12 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 08 Sep 2017 06:48:12 -0700 (PDT) Received-SPF: neutral (google.com: 192.35.17.2 is neither permitted nor denied by best guess record for domain of christian.storm@siemens.com) client-ip=192.35.17.2; Received: from mail2.siemens.de (mail2.siemens.de [139.25.208.11]) by thoth.sbs.de (8.15.2/8.15.2) with ESMTPS id v88DmC31009466 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Fri, 8 Sep 2017 15:48:12 +0200 Received: from MD1KR9XC.ad001.siemens.net ([139.25.69.251]) by mail2.siemens.de (8.15.2/8.15.2) with ESMTP id v88DmBKm021896; Fri, 8 Sep 2017 15:48:12 +0200 From: Christian Storm To: swupdate@googlegroups.com Cc: Christian Storm Subject: [swupdate] [PATCH 3/3] tmpdir: adapt documentation Date: Fri, 8 Sep 2017 15:45:47 +0200 Message-Id: <20170908134547.9170-3-christian.storm@siemens.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20170908134547.9170-1-christian.storm@siemens.com> References: <20170908134547.9170-1-christian.storm@siemens.com> X-Original-Sender: christian.storm@siemens.com X-Original-Authentication-Results: gmr-mx.google.com; spf=neutral (google.com: 192.35.17.2 is neither permitted nor denied by best guess record for domain of christian.storm@siemens.com) smtp.mailfrom=christian.storm@siemens.com 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: , Adapt the documentation to mention the use of $TMPDIR and /tmp as a fall-back if $TMPDIR is unset. Signed-off-by: Christian Storm --- doc/source/swupdate.rst | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/doc/source/swupdate.rst b/doc/source/swupdate.rst index 883ca45..4df0b6b 100644 --- a/doc/source/swupdate.rst +++ b/doc/source/swupdate.rst @@ -172,7 +172,9 @@ the image that must be installed. The feature can be set on image basis, that means that a user can decide which partial images should be streamed. If not streamed (see -installed-directly flag), files are temporary extracted into /tmp. +installed-directly flag), files are temporary extracted into the directory +pointed to by the environment variable ``TMPDIR`` with ``/tmp`` as +fall-back if ``TMPDIR`` is not set. Of course, by streaming it is not possible to make checks on the whole delivered software before installing. The temporary copy is done only when updated from network. When the image @@ -181,8 +183,9 @@ is stored on an external storage, there is no need of that copy. Images fully streamed --------------------- -In case of remote update, SWUpdate extracts relevant images -from the stream and copy them into /tmp before calling the handlers. +In case of remote update, SWUpdate extracts relevant images from the stream +and copies them into the directory pointed to by the environment variable +``TMPDIR`` (if unset, to ``/tmp``) before calling the handlers. This guarantee that an update is initiated only if all parts are present and correct. However, on some systems with less resources, the amount of RAM to copy the images could be not enough, for example if the filesystem on