From patchwork Tue Sep 12 11:13:35 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Babic X-Patchwork-Id: 812770 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:c09::23c; helo=mail-wm0-x23c.google.com; envelope-from=swupdate+bncbaabbzec37gqkgqel5pa2jy@googlegroups.com; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=googlegroups.com header.i=@googlegroups.com header.b="giEXsJfe"; dkim-atps=neutral Received: from mail-wm0-x23c.google.com (mail-wm0-x23c.google.com [IPv6:2a00:1450:400c:c09::23c]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3xs2Gy6YY0z9s82 for ; Tue, 12 Sep 2017 21:13:45 +1000 (AEST) Received: by mail-wm0-x23c.google.com with SMTP id n64sf506252wma.12 for ; Tue, 12 Sep 2017 04:13:45 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1505214821; cv=pass; d=google.com; s=arc-20160816; b=LGVIujKbH5a+DSjlLeDFg3S6f95bjVL+2uyFEzVI6wSCDBLz61KSJnroGjMH9Z3cqU rSwMznvUX0s8h5kf/2/Zz2Q+alGe6xB7VEpJYE7TMUu6+FGKoToEaUvlrc5T1rnSw8G5 NGhYQ9zRHqokI5Fzw47wP1WfDWKH0UzE3hxPt/Qw+IIol2/WAo9HGm3BjgnTxiYXFy3/ Ou1VK6OcSOFkS34KuJdeVNcQ0DS5b7EXMjzAiGSYRfkmKsU8oaI6qH3S5/xfP0b9Kq13 +NbEoMVuFRp05DrAOg8QD3zMVZVPoGKX6BXDcVg9JwZEdkXVZOWJGqYQfhXh+l2wAuoC Jlmg== 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=9Po6LB0AggwFjz3l0rblOc8hhOL502FyIQnpSgVEx10=; b=l6mHn7Pq4o8hJodTxPH3Ckp4TKi8ejUOvSxNS0r8BP18w3fL2opj4Ek4BHEK34Almn 4nRaDBjmiYHHXYkle2OjDlfmCkhss4wiPbdfqlg2b9V5EcX3zajHu0pr/jDkgV3O20tg F21B0nXj/FudBmyELm8Z5H9cssdkphwW4FyxT1ZFVGZi0i5wLeXATJjQwid2RJMaMUs9 myYokTz1U/Uqi21onfl0lpw21FAmhT4wxeS5FsSQdnAlR9CHRTEffYc33HhhLo+lTs6r /FasPRv9i+4XtMPVUpd+huVu9GmidFABHEC+hImmt7uEdcLT1AVZtrTHd5YPMUH4SxcX S00w== ARC-Authentication-Results: i=2; gmr-mx.google.com; spf=neutral (google.com: 212.18.0.9 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=9Po6LB0AggwFjz3l0rblOc8hhOL502FyIQnpSgVEx10=; b=giEXsJfeIxA/rNVUceW5fD+b+FyQtaADPUkStQHmLRXPHwDtf5HZ6RWxO2S8v0KZCG YOCZ/tBShmWdMMCR70ixHp1Mq0I2Q5AhDRIvrcP0NzCXLfa6p/3BiKwbY1oc+aHKnWVv 55xo/Ua5iB4OX9vLyY2sXtvVoIau/GFhflx0lJ2nfx7OOyAIwSpaWNa85kBgosYlOQ18 dQs67K+yFE1FzpB6NF5nSHW05kGqJIedHz3KP+ScgBxxvWdFxjKOmD0aOUxN9X7BMwlH yEnt/OWI+HlExV4pXfoCwKx8sEiNZHeQv4EWkgbwpeRdVhd6ahy4QVuoDfdL6ZEqW8iv B6yw== 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=9Po6LB0AggwFjz3l0rblOc8hhOL502FyIQnpSgVEx10=; b=WtfGd4srzBb10ju69uO1EYQLMuowLjPZj9+h034C5MWQujFcdMBh44l9rM9mOZuriu Cm6J9CPsTkJZFoGLLbBhMPd1qMt9FU8Ub/obbCJkPAyOm2x0JyJElt/UwJBKb35nfjgu wXjccAIULIlLZUV40fND9jMIZvnCz5Y8Hgt7nH534Da9qjFkcBVOYMlkS3cDC9RF6WF2 HUkY71yMo1M7TdhYi/+xW8fP/JLiGfUaVqhYYzgcfxFg5SKnMUtfh3ifg02ED3SP9U0/ 9/rX/QH72I8ms+8P/mLl/pI3OAssnMcPOqjVBWrGowyvqgQ+MzZ0OIehJPBxJlXLwaDw h9vw== Sender: swupdate@googlegroups.com X-Gm-Message-State: AHPjjUiWuMq8vh1xgJY8ROoH9lmHMeuidFHbBZHpnPs1X46zkZXK9Hvy 7hnNbv9QZXIV0rs+mqDFVSI= X-Google-Smtp-Source: AOwi7QAx0NWo2BmbzgDbjEq5W+m+BOh2oPjDqBhsDDNHjG7P4tsxF+iQ2xG+bNf/IcpI9oQDbj4z2w== X-Received: by 10.28.128.19 with SMTP id b19mr25391wmd.7.1505214820928; Tue, 12 Sep 2017 04:13:40 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: swupdate@googlegroups.com Received: by 10.28.137.207 with SMTP id l198ls295117wmd.6.gmail; Tue, 12 Sep 2017 04:13:40 -0700 (PDT) X-Received: by 10.223.134.175 with SMTP id 44mr838125wrx.11.1505214820598; Tue, 12 Sep 2017 04:13:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1505214820; cv=none; d=google.com; s=arc-20160816; b=q9yfVP8zR2HZsjgBXbE5+FbpsG6Jggm+ZZna0GpA/VlVSG+bAyTMWhZrqjFRTsFrji 1G+0O9saygpG3Rvi7uSBevOqT9kIrsqTyKc+KFUOJ0ErOntv0fbZEGM3oUVViLH/aHuB u3BXkim83O4WZZPUnrMHh/4kYoyNuxMP5Vvqr9hn0vepLP2iYoiObqNW2QipgXkFGGYK uVQE52MZloMLFvrrKFprFczma6Fps8RpMTVN08HriO5zj+VY+e9RHRwRqEbAumfpHxnB hlgnh58VbrAa2iMhC++d81XoMOjRPUbkZPoSXvwhP1LwMRAisLaBaxYX9M0cXhX0lUiL GdDw== 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=AhpNjn8pMYbUSc8z7g3fBg5sB76xJudu6SSCymOQCf8=; b=lwMDBrK6Pcq5WHHAppEvYBw3UFdFTkvAjVKRiGAlkInCQTgaRx4xQqk5kRyYAMNpWW mDEIEDVaog5mo/PSaWAonGlqUQSa/ug5we6v4xbxJt4SGzwgBkaKZs9qg5TJFZoUgnKi lWpD/NZeiUOBbKE3DsK2ZhGTYnsiQHn+KHAyB6N5wzuC0cw9Usb+VlCiXTJYOMkzP4eL HOYKxBB2gSCrnmYSNXlKLSmLw8o7cEWLCTlQIaflleHdtlZUrvlydAxReTfctxb+aq1u OSvjuI1NOOoOB6F4W6wQIyhGwtUQiQtVNJNj/fqAY0Juk94sJdE3keqTPWblEmv/tC1x DkuQ== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=neutral (google.com: 212.18.0.9 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.9]) by gmr-mx.google.com with ESMTPS id t142si766785wmt.2.2017.09.12.04.13.40 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 12 Sep 2017 04:13:40 -0700 (PDT) Received-SPF: neutral (google.com: 212.18.0.9 is neither permitted nor denied by best guess record for domain of sbabic@denx.de) client-ip=212.18.0.9; Received: from frontend03.mail.m-online.net (unknown [192.168.6.182]) by mail-out.m-online.net (Postfix) with ESMTP id 3xs2Gr2W1Gz1qxxZ; Tue, 12 Sep 2017 13:13:40 +0200 (CEST) Received: from localhost (dynscan3.mnet-online.de [192.168.6.84]) by mail.m-online.net (Postfix) with ESMTP id 3xs2Gr2Bcbz1qsQG; Tue, 12 Sep 2017 13:13:40 +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 IsUjCwkiiP1x; Tue, 12 Sep 2017 13:13:39 +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:13:39 +0200 (CEST) Received: from localhost (mail.babic.homelinux.org [127.0.0.1]) by babic.homelinux.org (Postfix) with ESMTP id 2E8D945405CE; Tue, 12 Sep 2017 13:13:39 +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 zNkVG9P5jG36; Tue, 12 Sep 2017 13:13:36 +0200 (CEST) Received: from papero.fritz.box (papero.fritz.box [192.168.178.132]) by babic.homelinux.org (Postfix) with ESMTP id 8394D45405CD; Tue, 12 Sep 2017 13:13:36 +0200 (CEST) From: Stefano Babic To: swupdate@googlegroups.com Cc: Stefano Babic , Christian Storm Subject: [swupdate] [PATCH] Fix usage of TMPDIR Date: Tue, 12 Sep 2017 13:13:35 +0200 Message-Id: <1505214815-19857-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: 212.18.0.9 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 CC: Christian Storm --- corelib/lua_interface.c | 1 + handlers/lua_scripthandler.c | 7 +++++-- 2 files changed, 6 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/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 */