From patchwork Tue Sep 12 11:56:59 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Babic X-Patchwork-Id: 812812 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::237; helo=mail-lf0-x237.google.com; envelope-from=swupdate+bncbaabbeux37gqkgqeqijv4yy@googlegroups.com; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=googlegroups.com header.i=@googlegroups.com header.b="oiClnmzj"; dkim-atps=neutral Received: from mail-lf0-x237.google.com (mail-lf0-x237.google.com [IPv6:2a00:1450:4010:c07::237]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3xs3F26SyKz9t2V for ; Tue, 12 Sep 2017 21:57:09 +1000 (AEST) Received: by mail-lf0-x237.google.com with SMTP id 23sf333668lfs.12 for ; Tue, 12 Sep 2017 04:57:09 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1505217426; cv=pass; d=google.com; s=arc-20160816; b=CWwWOZ57XR/z4uGkwytPjrx3CWpKAavB19FaGP/1XCy4E5D8MEiLt2eoB/TS0fKQO7 05RSBmJvBFFXsGmwkwFtRQPkaIakMuGREuFc1B2xy5P7TbiiEolAsJm9jmTfQMWErQ2d jUZxHnWLcbefWDO/G4sdhJY5QmA3Edar37UgN3pS16O0gSRsP9P3u8p1xRS3+zOwNcF3 /hH6+OxdoWNY+3gwucBCrY8DJKg/GYCjZk0NVhqy+IDtQcCkZoRy9JnEOJor/FsDcWcV sweXTl/Rh0NSaIpTflOeGdGovTmYs/It5fgAcXS2OblBA/lcNpCPIizv147eSfbHVWAR Cx2A== 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=vGeWD25X9sJCUinZXszxgUSVqhlay0UzWKLmgFV/LXg=; b=1EihXkVnJrjcy8e1ZmZZ6hu8wkrIsmU0p7eZAI/g+QHIMobpNCkiMnfhku/Kj8P2yj 86e73/wUBpNKxOhJyWvXVwk1ygqbuh24Rzc1nlII/W78ytbIAs7bnDk3kolUqfbKK5BR 3S9GHKg/gZHXd2iKV/jgrO/47V/Kyw4qvSOcRou0Gcpvbr0vjt3y+v9hm7OLts5OIU33 C2kBtw8Cy7TcaKZOi5Iq3Q7aWAJ3lvU8qLSALEJNkEb8VmYjveKPFnrIl3vAMQk6qSri YQhGsYzJNTga5pk2UZse7LmHY2pwxvwgyT7KWR7iB+AGg1U+GBfKTpZZIl9ZVD2j2O3Z +LuQ== ARC-Authentication-Results: i=2; gmr-mx.google.com; spf=neutral (google.com: 2001:a60:0:28:0:1:25:1 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=vGeWD25X9sJCUinZXszxgUSVqhlay0UzWKLmgFV/LXg=; b=oiClnmzjbSvtcRrmAhy5q6DK/Sqw04yMKIaBthXhCIyTxE+l9Ju2dLRO4ogkALdOpF 8q4GZl++jdBD/bEMWu5ljUYme3AMEomT0MsWiylmQVwPCnSDYxtddcyjOu21KMjCpD1+ VwrsyRAOD5IowchZ7uT9BcQVdbu6ekOVicBU9dm8Kpi1ztQJOxD5HclwxBmBNECSDQRp nbUOcb7V4T7gxVFVJ+0kNAZQdDgH/Ay23oGFX/wlV+A4719WvmS5byP19cFmoGW4NkYD mRu3p579N3Uv+Z34UoWqJ1O65tlplSq4UxYqbIkFU1eM74V3mS9gWGu+/79cu+2yCZO9 ifoQ== 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=vGeWD25X9sJCUinZXszxgUSVqhlay0UzWKLmgFV/LXg=; b=iYqIpUBz7rG0VJFfDTWvam0qXIO/XvBETHq9ulmnLt5QaY9dN1EZW1giJFjPF6CZ9f I/lXUc5oXA4VkOol8Q5DYt6lKbQ73I4MLDasPCyr+QlPBmU2ouGylhd0wS2fp8AeqPwJ vxpSuMa+XWl14H02fYDO06wsIeY3oeblevp1kCGvcNuq+UAGBAbO4HVCCbsRZPIMr+x/ nLZFGUxaomEk1e7B+aGlhDmzBVwW8SXalWwaIl9TtfUzJt2eoPX42iUDwRlMF5TUF+6A QfftU8yVpSNacQum1Bi43fM8XUZAEGzmNs+XKB7N2UL5kJNaBge+gmDiRBykwFcVihLp D1+Q== Sender: swupdate@googlegroups.com X-Gm-Message-State: AHPjjUgHMy5AoF8QrEAO8SJF+hWs9R3OuA2pZwmrhcHSWIOgWTi1tUK8 4YVtgswYr63e2A== X-Google-Smtp-Source: AOwi7QAta3p+1CuDH4CPaf/DU+KyQtYT8Cqpp60/9nFW5zgGgwqlF28Z6Mmn7iTPc8fsbENTzcFrcw== X-Received: by 10.46.2.85 with SMTP id 82mr2027ljc.16.1505217426065; Tue, 12 Sep 2017 04:57:06 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: swupdate@googlegroups.com Received: by 10.46.25.83 with SMTP id p80ls89907lje.47.gmail; Tue, 12 Sep 2017 04:57:05 -0700 (PDT) X-Received: by 10.46.92.193 with SMTP id q184mr1168354ljb.34.1505217425946; Tue, 12 Sep 2017 04:57:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1505217425; cv=none; d=google.com; s=arc-20160816; b=Lm0qrr1UBUWwpId5aCP6yOyUsRr9+G8FpGKRBMqhfO+IGVcK4UV5LmO81Bfn/vrCdC fOICisST3WgDGyEjWmD0SwWywNcfMvrSRvsei5vaV9CNIjrUCB6cRK7wADCpQc9hRPu8 2f1bA23vbaC/1mqdDW0Ee0W/hY2LRAYO3TKwHDIPJ7Lkl+If841nl3WRGW2lb2GZSc7I M4ZTO6kOvMpRveSJgoRLbqpTeXRUfkaDgxRZNfytc1eL+YuOdoIxZCpsWT3YpwFbztle g7tzlzGpqa4ea6b3L0Fc4+QewE3GMDm/wVVw+Ajp3uSVKV/63t4g9zhCpE4BAZD++RpP Zcng== 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=9fWr/EYlW+1+zmzEVr7lQrj4oJWAKJBDLeFYu7icmFA=; b=wzb4K+fuWSNUCZHj0WklKnySVPa3veVQ0qnuwyAuF3t7/YKibvjJ4fYVYudO9vBeii 6mSA1EMC5sIzz8ti1II6I3zUzV89fv8EPwF6itqD/0pgyIX42b4baMRzko+ubWIXZgxJ zhBpzz7eDpbt2X8ZfwL1vWDD8yusvDsV4H3KBBxVyUZl9g/E0jTF7h+7qXOiIVoCcixY S1+UyIYGrELqAIM99ySpKmwTHFHwQYv4PuZVF2Ut5FhL54n+Slzi44XYkukMIrbE7m2Q BJcEMObsea5ovABHZfP3T1myZ6rORSEAfLAY9tFRhGy61JZJigvv8qvVGPrM3Wd2jTay 6wHA== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=neutral (google.com: 2001:a60:0:28:0:1:25:1 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. [2001:a60:0:28:0:1:25:1]) by gmr-mx.google.com with ESMTPS id r3si698543wmg.6.2017.09.12.04.57.05 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 12 Sep 2017 04:57:05 -0700 (PDT) Received-SPF: neutral (google.com: 2001:a60:0:28:0:1:25:1 is neither permitted nor denied by best guess record for domain of sbabic@denx.de) client-ip=2001:a60:0:28:0:1:25:1; Received: from frontend03.mail.m-online.net (unknown [192.168.6.182]) by mail-out.m-online.net (Postfix) with ESMTP id 3xs3Dx4DjPz1qvyk; Tue, 12 Sep 2017 13:57:05 +0200 (CEST) Received: from localhost (dynscan3.mnet-online.de [192.168.6.84]) by mail.m-online.net (Postfix) with ESMTP id 3xs3Dx42mlz1qsQ3; Tue, 12 Sep 2017 13:57:05 +0200 (CEST) X-Virus-Scanned: amavisd-new at mnet-online.de Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan3.mail.m-online.net [192.168.6.84]) (amavisd-new, port 10024) with ESMTP id o-xIYenLqzrs; Tue, 12 Sep 2017 13:57:04 +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; Tue, 12 Sep 2017 13:57:04 +0200 (CEST) Received: from localhost (mail.babic.homelinux.org [127.0.0.1]) by babic.homelinux.org (Postfix) with ESMTP id 69F5145405CE; Tue, 12 Sep 2017 13:57:04 +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 of8CgLAvaPFC; Tue, 12 Sep 2017 13:57:02 +0200 (CEST) Received: from papero.fritz.box (papero.fritz.box [192.168.178.132]) by babic.homelinux.org (Postfix) with ESMTP id 00CCC45405CD; Tue, 12 Sep 2017 13:57:01 +0200 (CEST) From: Stefano Babic To: swupdate@googlegroups.com Cc: Stefano Babic Subject: [swupdate] [PATCH V3] Fix usage of TMPDIR Date: Tue, 12 Sep 2017 13:56:59 +0200 Message-Id: <1505217419-28446-1-git-send-email-sbabic@denx.de> X-Mailer: git-send-email 2.7.4 X-Original-Sender: sbabic@denx.de X-Original-Authentication-Results: gmr-mx.google.com; spf=neutral (google.com: 2001:a60:0:28:0:1:25:1 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: , Commit 7ce284c5401c64bcd54e469ce8a3f7639e28ed3a makes TMPDIR configurable. Fix the remaining sources that use the TMPDIR variable. Signed-off-by: Stefano Babic Acked-by: Christian Storm --- corelib/lua_interface.c | 1 + handlers/flash_hamming1_handler.c | 1 + handlers/flash_handler.c | 1 + handlers/lua_scripthandler.c | 7 +++++-- 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/corelib/lua_interface.c b/corelib/lua_interface.c index 90c2230..5717807 100644 --- a/corelib/lua_interface.c +++ b/corelib/lua_interface.c @@ -401,6 +401,7 @@ static int l_handler_wrapper(struct img_type *img, void *data) { lua_Number result; int l_func_ref; int fdout; + const char* TMPDIR = get_tmpdir(); if (!gL || !img || !data) { return -1; diff --git a/handlers/flash_hamming1_handler.c b/handlers/flash_hamming1_handler.c index 44141fd..8b54d3a 100644 --- a/handlers/flash_hamming1_handler.c +++ b/handlers/flash_hamming1_handler.c @@ -294,6 +294,7 @@ static int install_flash_hamming_image(struct img_type *img, char filename[64]; int mtdnum; int n; + const char* TMPDIR = get_tmpdir(); n = snprintf(filename, sizeof(filename), "%s%s", TMPDIR, img->fname); if (n < 0 || n >= sizeof(filename)) { diff --git a/handlers/flash_handler.c b/handlers/flash_handler.c index 081c2a4..ff27aa7 100644 --- a/handlers/flash_handler.c +++ b/handlers/flash_handler.c @@ -312,6 +312,7 @@ static int install_flash_image(struct img_type *img, char filename[64]; int mtdnum; int n; + const char* TMPDIR = get_tmpdir(); n = snprintf(filename, sizeof(filename), "%s%s", TMPDIR, img->fname); if (n < 0 || n >= sizeof(filename)) { diff --git a/handlers/lua_scripthandler.c b/handlers/lua_scripthandler.c index a3df317..1793878 100644 --- a/handlers/lua_scripthandler.c +++ b/handlers/lua_scripthandler.c @@ -44,9 +44,11 @@ static int start_lua_script(struct img_type *img, void *data) int ret; const char *fnname; const char *output; - char filename[64]; script_fn scriptfn; lua_State *L = luaL_newstate(); /* opens Lua */ + const char* TMPDIR = get_tmpdir(); + char filename[MAX_IMAGE_FNAME + strlen(TMPDIR) + + strlen(SCRIPTS_DIR_SUFFIX) + 2]; if (!data) return -1; @@ -65,7 +67,8 @@ static int start_lua_script(struct img_type *img, void *data) return 0; } - snprintf(filename, sizeof(filename), "%s%s", TMPDIR, img->fname); + snprintf(filename, sizeof(filename), + "%s%s%s", TMPDIR, SCRIPTS_DIR_SUFFIX, img->fname); TRACE("Calling Lua %s", filename); luaL_openlibs(L); /* opens the standard libraries */