[{"id":1766925,"web_url":"http://patchwork.ozlabs.org/comment/1766925/","msgid":"<20170912115050.lbzfddklt3zfurjp@MD1KR9XC.ww002.siemens.net>","list_archive_url":null,"date":"2017-09-12T11:50:50","subject":"Re: [swupdate] [PATCH V2] Fix usage of TMPDIR","submitter":{"id":72180,"url":"http://patchwork.ozlabs.org/api/people/72180/","name":"Storm, Christian","email":"christian.storm@siemens.com"},"content":"Hi Stefano,\n\n> Commit 7ce284c5401c64bcd54e469ce8a3f7639e28ed3a makes TMPDIR\n> configurable. Fix the remaining sources that use the TMPDIR variable.\n> \n> Signed-off-by: Stefano Babic <sbabic@denx.de>\n> ---\n> \n> Changes since V1:\n> \t- flash handler was not fixed\n> \n>  corelib/lua_interface.c      | 1 +\n>  handlers/flash_handler.c     | 1 +\n>  handlers/lua_scripthandler.c | 7 +++++--\n>  3 files changed, 7 insertions(+), 2 deletions(-)\n> \n> diff --git a/corelib/lua_interface.c b/corelib/lua_interface.c\n> index 90c2230..5717807 100644\n> --- a/corelib/lua_interface.c\n> +++ b/corelib/lua_interface.c\n> @@ -401,6 +401,7 @@ static int l_handler_wrapper(struct img_type *img, void *data) {\n>  \tlua_Number result;\n>  \tint l_func_ref;\n>  \tint fdout;\n> +\tconst char* TMPDIR = get_tmpdir();\n>  \n>  \tif (!gL || !img || !data) {\n>  \t\treturn -1;\n> diff --git a/handlers/flash_handler.c b/handlers/flash_handler.c\n> index 081c2a4..ff27aa7 100644\n> --- a/handlers/flash_handler.c\n> +++ b/handlers/flash_handler.c\n> @@ -312,6 +312,7 @@ static int install_flash_image(struct img_type *img,\n>  \tchar filename[64];\n>  \tint mtdnum;\n>  \tint n;\n> +\tconst char* TMPDIR = get_tmpdir();\n>  \n>  \tn = snprintf(filename, sizeof(filename), \"%s%s\", TMPDIR, img->fname);\n>  \tif (n < 0 || n >= sizeof(filename)) {\n> diff --git a/handlers/lua_scripthandler.c b/handlers/lua_scripthandler.c\n> index a3df317..1793878 100644\n> --- a/handlers/lua_scripthandler.c\n> +++ b/handlers/lua_scripthandler.c\n> @@ -44,9 +44,11 @@ static int start_lua_script(struct img_type *img, void *data)\n>  \tint ret;\n>  \tconst char *fnname;\n>  \tconst char *output;\n> -\tchar filename[64];\n>  \tscript_fn scriptfn;\n>  \tlua_State *L = luaL_newstate(); /* opens Lua */\n> +\tconst char* TMPDIR = get_tmpdir();\n> +\tchar filename[MAX_IMAGE_FNAME + strlen(TMPDIR) +\n> +\t\tstrlen(SCRIPTS_DIR_SUFFIX) + 2];\n>  \n>  \tif (!data)\n>  \t\treturn -1;\n> @@ -65,7 +67,8 @@ static int start_lua_script(struct img_type *img, void *data)\n>  \t\treturn 0;\n>  \t}\n>  \n> -\tsnprintf(filename, sizeof(filename), \"%s%s\", TMPDIR, img->fname);\n> +\tsnprintf(filename, sizeof(filename),\n> +\t\t\"%s%s%s\", TMPDIR, SCRIPTS_DIR_SUFFIX, img->fname);\n>  \tTRACE(\"Calling Lua %s\", filename);\n>  \n>  \tluaL_openlibs(L); /* opens the standard libraries */\n> -- \n> 2.7.4\n> \n\nThanks! It is obviously surprisingly hard to find all\nthose occurrences :)\n\nAcked-by: Christian Storm <christian.storm@siemens.com>\n\n\nKind regards,\n   Christian","headers":{"Return-Path":"<swupdate+bncBDD6BWV65QPBBNMV37GQKGQECN4KELY@googlegroups.com>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=googlegroups.com\n\t(client-ip=2a00:1450:400c:c09::240;\n\thelo=mail-wm0-x240.google.com;\n\tenvelope-from=swupdate+bncbdd6bwv65qpbbnmv37gqkgqecn4kely@googlegroups.com;\n\treceiver=<UNKNOWN>)","ozlabs.org; dkim=pass (2048-bit key;\n\tunprotected) header.d=googlegroups.com header.i=@googlegroups.com\n\theader.b=\"YMTK4ffY\"; dkim-atps=neutral"],"Received":["from mail-wm0-x240.google.com (mail-wm0-x240.google.com\n\t[IPv6:2a00:1450:400c:c09::240])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xs38m0BZ1z9t30\n\tfor <incoming@patchwork.ozlabs.org>;\n\tTue, 12 Sep 2017 21:53:27 +1000 (AEST)","by mail-wm0-x240.google.com with SMTP id r203sf818860wmb.13\n\tfor <incoming@patchwork.ozlabs.org>;\n\tTue, 12 Sep 2017 04:53:27 -0700 (PDT)","by 10.28.208.205 with SMTP id h196ls239792wmg.26.canary-gmail; Tue,\n\t12 Sep 2017 04:53:24 -0700 (PDT)","from david.siemens.de (david.siemens.de. [192.35.17.14])\n\tby gmr-mx.google.com with ESMTPS id\n\te135si718164wmg.6.2017.09.12.04.53.24\n\tfor <swupdate@googlegroups.com>\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tTue, 12 Sep 2017 04:53:24 -0700 (PDT)","from mail1.siemens.de (mail1.siemens.de [139.23.33.14])\n\tby david.siemens.de (8.15.2/8.15.2) with ESMTPS id v8CBrOt8031662\n\t(version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK)\n\tfor <swupdate@googlegroups.com>; Tue, 12 Sep 2017 13:53:24 +0200","from localhost ([139.25.69.251])\n\tby mail1.siemens.de (8.15.2/8.15.2) with ESMTPS id v8CBrNx7027151\n\t(version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO)\n\tfor <swupdate@googlegroups.com>; Tue, 12 Sep 2017 13:53:24 +0200"],"ARC-Seal":["i=2; a=rsa-sha256; t=1505217205; cv=pass;\n\td=google.com; s=arc-20160816;\n\tb=Ya1fc1EgFG9YLX0gS6WZMUSiB/LxD/ghKkZpHkfy77EjxgAu1K4zsys3CnSGSb3EC9\n\tZlE53m2XjxzJXZa0n97nE3uobQkm3SWCNnGsfOWap2FzR2SpSbQMiF88e7+0WZetCr29\n\tXvdTIgudjnzhBcgyaVlTsbgZFkUe7g8gOcnsmCjflHgo6HPlQ7v8yZbs8tGliBssjSAw\n\tFW5resdX7lUFg9IlXGyBhSCQvz4YUhVa8XJAtXWIX9ch4jYwtIWhxQ+9EQ8eb9IjvTgS\n\tw11OM/vb9uHJwck0IRabwmRog56NX8cl23iY8y36xoyhMJIIZkOy+Et7tzx65JdcMbGQ\n\tslvQ==","i=1; a=rsa-sha256; t=1505217204; cv=none;\n\td=google.com; s=arc-20160816;\n\tb=f0E3LRBemaEHcQts3mkAhT2lnNk1EyMlcPFMEFJYC1aBXtldOTqhwX1hkSbmI5JLnK\n\t8KolszAcCm+rwVcj9NeRJc8NXDOYzZc/gMkRVOGg4XdFhEJjKyvmt4Yco+abQXjAtx+M\n\tmfSd3gVaCi3uqHI0FWqTJVqhKv9bRenDBQapJEyogNgNH+PH6oYLUPtQphZJli+L3ISn\n\tYGWqj8nDnA+pYgz7rHryiSOfkj1xI8sxjBkWKP5azSnFUdhXqlGv80FJE37tpHeu/qv7\n\tK71GU8FRIGQwhjq5BP1XlbDvFRKiQQgGyJ1eQnhby0/HIb7kIy2roa9cq4d6Z7JFAnPH\n\tFWbg=="],"ARC-Message-Signature":["i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com;\n\ts=arc-20160816; \n\th=list-unsubscribe:list-subscribe:list-archive:list-help:list-post\n\t:list-id:mailing-list:precedence:user-agent:in-reply-to\n\t:content-transfer-encoding:content-disposition:mime-version\n\t:mail-followup-to:message-id:subject:to:from:date\n\t:arc-authentication-results:arc-message-signature:sender\n\t:dkim-signature:arc-authentication-results;\n\tbh=8en6IHe3vZDYg10BQ8FapNg6gkfa63jI6hQxUjBWJOc=;\n\tb=PRSWvyPdcs50idXt7TjTc/DfISlSUKr8zl8uQy2thpTdwwcLetN57tk+/BOneJ5cT1\n\tHJv/qBsAo/d/XAxH+mE0+10vkB9cV6E44ky92d0YpjMi2ljlB95E+51cTF831xcwptwx\n\togmHg56R2YTeGpH+gXu1i9ISWTeiRN6nzcOa+Gb2CVbFedpK0bdS5waLoIroW1851Sdl\n\tCLylVTrJUULPKsYSawiSKp0/UTyfOhQRQOEz/1068X14LgWZb2VdM2QD6/b6nplwsx+7\n\tYIpmd1ejkLwiwYL7krH6ShEopo+wGPApHVrEmJyWgs1KWCV3S4JIqeXzTVddHnwhQLzf\n\tmZsw==","i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com;\n\ts=arc-20160816; \n\th=user-agent:in-reply-to:content-transfer-encoding\n\t:content-disposition:mime-version:mail-followup-to:message-id\n\t:subject:to:from:date:arc-authentication-results;\n\tbh=Q7G9atGPxN4m3fbxVXublEC6O6kdZs+pscE6Rb3s330=;\n\tb=cJFGCebKuEdoUmZnO0BPSLEntjq0rC+J3j5eQQzL6Rw+EEv7Gb2ZlgYWr4w+nCPCnx\n\ts+qg69hUmf1qNMO34mpJ2Mz9OkDTS/DvHBgN1TxTZ4LL0u6H1Ykh0+PwxhTb54P9x2Ze\n\t58KIIuxdADYGaf1qDk7avfc0id9yM8q6ucljDr5kgzsXPnKlq5sUVtVVPVOFPjxXDuNn\n\ty35z9cKhqk1NXQifDfSpJiFHMqUP9pZfSwAyMTvNhsf1oEp53Vc1LSiUWKsjMCCSeNwT\n\t8P7oO9uzTOnHJiCWh86H/ey4HfGovMBrFI1gtrbzAziK9d2nfeIsHbuYCWY4vDSHlyE0\n\t8tKA=="],"ARC-Authentication-Results":["i=2; gmr-mx.google.com;\n\tspf=neutral (google.com: 192.35.17.14 is neither permitted nor denied\n\tby best guess record for domain of\n\tchristian.storm@siemens.com)\n\tsmtp.mailfrom=christian.storm@siemens.com","i=1; gmr-mx.google.com;\n\tspf=neutral (google.com: 192.35.17.14 is neither permitted nor denied\n\tby best guess record for domain of\n\tchristian.storm@siemens.com)\n\tsmtp.mailfrom=christian.storm@siemens.com"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=googlegroups.com; s=20161025;\n\th=sender:date:from:to:subject:message-id:mail-followup-to\n\t:mime-version:content-disposition:content-transfer-encoding\n\t:in-reply-to:user-agent:x-original-sender\n\t:x-original-authentication-results:precedence:mailing-list:list-id\n\t:list-post:list-help:list-archive:list-subscribe:list-unsubscribe;\n\tbh=8en6IHe3vZDYg10BQ8FapNg6gkfa63jI6hQxUjBWJOc=;\n\tb=YMTK4ffYpTFQj5lTEPy6jnPRdSaHzSsha8RzKd9exyUepDtEA+IrxA3ljAX9ZtsePx\n\tO1SpAI19FaWY0CK5l9mS/5U3t5E1boNe0lxLxROUwN0Mk210Y2N2eKKgmjqWmySZhtjf\n\tE3JC2pB49KaGOdFpkKTegP/WNUehNO3N3Kv4oSASEhVvsUB2EfFfSEHBLeaU1xLYouCc\n\tMq1zWM64wuDvS1mh2kILGH/3o5XoO8F5wtGaZTQgeDHn9L/LTX3oN2sJyCBTw4441Awb\n\tJe2WQdhom7PEo+Gv8F1YYytxFmQSNwLnC698hqPnnATuRITm5lnxw6r5Y8WSLALXo2aD\n\tU0ZQ==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=sender:x-gm-message-state:date:from:to:subject:message-id\n\t:mail-followup-to:mime-version:content-disposition\n\t:content-transfer-encoding:in-reply-to:user-agent:x-original-sender\n\t:x-original-authentication-results:precedence:mailing-list:list-id\n\t:x-spam-checked-in-group:list-post:list-help:list-archive\n\t:list-subscribe:list-unsubscribe;\n\tbh=8en6IHe3vZDYg10BQ8FapNg6gkfa63jI6hQxUjBWJOc=;\n\tb=s8UIp1D4dylsqMNR8FxOlvnQkWK3whFJ3joOr5TNAMTYqcYYzzuiOK6n/J3gmCsj06\n\tX3ulwaktXLenIgGcuYUGNcxFevvjHWrWphXUPTl8eFNYEiGN6/Opd1CwxTOnywM+t047\n\tdDhdB4ae90Nfpzqkj0uUXonMpe6TNpH2lCb3xZBrC0q5L5mfQu5Vu0LCk/Sb7gG2sFr9\n\tCkje3LQNKsBI1xXCFsvsWm8r1s61eNdcDbLlOtnKHonFWuHhKfMX26uGoYwvhVuFrJlE\n\tKeFAHNMhH4FxDE6zRjzLVnvqSk/J0dRvp7Vmz9006fZmdbRVqRuEv++wqpSkpN5kAzu4\n\tLKQQ==","Sender":"swupdate@googlegroups.com","X-Gm-Message-State":"AHPjjUiq4iqcgM6hBPVOYT85PFa5EatJ+FA4r7dTWJKz4kE/rOh4vKRw\n\t2lLxw1ZJc9SHDg==","X-Google-Smtp-Source":"AOwi7QCZffym6Xj+DwdsqzY9nU1FU9OrXh+9aUwFWz1F0WYkPZdddHM3vgL7fKOk/F1mJlrK32UNNA==","X-Received":["by 10.28.216.195 with SMTP id p186mr22944wmg.27.1505217205158;\n\tTue, 12 Sep 2017 04:53:25 -0700 (PDT)","by 10.28.212.14 with SMTP id l14mr74791wmg.11.1505217204724;\n\tTue, 12 Sep 2017 04:53:24 -0700 (PDT)"],"X-BeenThere":"swupdate@googlegroups.com","Received-SPF":"neutral (google.com: 192.35.17.14 is neither permitted nor\n\tdenied by best guess record for domain of\n\tchristian.storm@siemens.com) client-ip=192.35.17.14; ","Date":"Tue, 12 Sep 2017 13:50:50 +0200","From":"Christian Storm <christian.storm@siemens.com>","To":"swupdate@googlegroups.com","Subject":"Re: [swupdate] [PATCH V2] Fix usage of TMPDIR","Message-ID":"<20170912115050.lbzfddklt3zfurjp@MD1KR9XC.ww002.siemens.net>","Mail-Followup-To":"swupdate@googlegroups.com","MIME-Version":"1.0","Content-Type":"text/plain; charset=\"UTF-8\"","Content-Disposition":"inline","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<1505215260-21152-1-git-send-email-sbabic@denx.de>","User-Agent":"Mutt/20170113 (1.7.2)","X-Original-Sender":"christian.storm@siemens.com","X-Original-Authentication-Results":"gmr-mx.google.com;       spf=neutral\n\t(google.com: 192.35.17.14 is neither permitted nor denied by best\n\tguess\n\trecord for domain of christian.storm@siemens.com)\n\tsmtp.mailfrom=christian.storm@siemens.com","Precedence":"list","Mailing-list":"list swupdate@googlegroups.com;\n\tcontact 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>,\n\t<mailto:swupdate@googlegroups.com>","List-Help":"<https://groups.google.com/support/>,\n\t<mailto:swupdate+help@googlegroups.com>","List-Archive":"<https://groups.google.com/group/swupdate","List-Subscribe":"<https://groups.google.com/group/swupdate/subscribe>,\n\t<mailto:swupdate+subscribe@googlegroups.com>","List-Unsubscribe":"<mailto:googlegroups-manage+605343134186+unsubscribe@googlegroups.com>,\n\t<https://groups.google.com/group/swupdate/subscribe>"}}]