get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/1.2/patches/811602/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 811602,
    "url": "http://patchwork.ozlabs.org/api/1.2/patches/811602/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/swupdate/patch/20170908134547.9170-2-christian.storm@siemens.com/",
    "project": {
        "id": 58,
        "url": "http://patchwork.ozlabs.org/api/1.2/projects/58/?format=api",
        "name": "swupdate development",
        "link_name": "swupdate",
        "list_id": "swupdate.googlegroups.com",
        "list_email": "swupdate@googlegroups.com",
        "web_url": "https://github.com/sbabic/swupdate",
        "scm_url": "git://github.com/sbabic/swupdate",
        "webscm_url": "",
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<20170908134547.9170-2-christian.storm@siemens.com>",
    "list_archive_url": null,
    "date": "2017-09-08T13:45:46",
    "name": "[2/3] tmpdir: make use of get_tmpdir()",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "9b086938a0bf964db8cb08ef746adc9c24355a68",
    "submitter": {
        "id": 72180,
        "url": "http://patchwork.ozlabs.org/api/1.2/people/72180/?format=api",
        "name": "Storm, Christian",
        "email": "christian.storm@siemens.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/swupdate/patch/20170908134547.9170-2-christian.storm@siemens.com/mbox/",
    "series": [
        {
            "id": 2217,
            "url": "http://patchwork.ozlabs.org/api/1.2/series/2217/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/swupdate/list/?series=2217",
            "date": "2017-09-08T13:45:47",
            "name": "[1/3] tmpdir: introduce get_tmpdir() respecting TMPDIR",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/2217/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/811602/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/811602/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<swupdate+bncBDD6BWV65QPBBHN7ZLGQKGQEG5VJFYY@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:c0c::23f;\n\thelo=mail-wr0-x23f.google.com;\n\tenvelope-from=swupdate+bncbdd6bwv65qpbbhn7zlgqkgqeg5vjfyy@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=\"b9B0H6du\"; dkim-atps=neutral"
        ],
        "Received": [
            "from mail-wr0-x23f.google.com (mail-wr0-x23f.google.com\n\t[IPv6:2a00:1450:400c:c0c::23f])\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 3xpdv52v5sz9sBZ\n\tfor <incoming@patchwork.ozlabs.org>;\n\tFri,  8 Sep 2017 23:48:17 +1000 (AEST)",
            "by mail-wr0-x23f.google.com with SMTP id d6sf244771wrd.9\n\tfor <incoming@patchwork.ozlabs.org>;\n\tFri, 08 Sep 2017 06:48:17 -0700 (PDT)",
            "by 10.28.168.81 with SMTP id r78ls33492wme.27.gmail; Fri, 08 Sep\n\t2017 06:48:13 -0700 (PDT)",
            "from david.siemens.de (david.siemens.de. [192.35.17.14])\n\tby gmr-mx.google.com with ESMTPS id\n\tr8si190734wma.4.2017.09.08.06.48.12 for <swupdate@googlegroups.com>\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tFri, 08 Sep 2017 06:48:12 -0700 (PDT)",
            "from mail2.siemens.de (mail2.siemens.de [139.25.208.11])\n\tby david.siemens.de (8.15.2/8.15.2) with ESMTPS id v88DmCUP000489\n\t(version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK)\n\tfor <swupdate@googlegroups.com>; Fri, 8 Sep 2017 15:48:12 +0200",
            "from MD1KR9XC.ad001.siemens.net ([139.25.69.251])\n\tby mail2.siemens.de (8.15.2/8.15.2) with ESMTP id v88DmBKl021896;\n\tFri, 8 Sep 2017 15:48:12 +0200"
        ],
        "ARC-Seal": [
            "i=2; a=rsa-sha256; t=1504878493; cv=pass;\n\td=google.com; s=arc-20160816;\n\tb=X8RIjNhc9ifRzj8BJ9kBex/+ZVT/s2/FYhY0mMjztdLIAO+BCoK/06jfy3yFJmEKO/\n\tkrgBxek0Amw946luKLy/onNWI/RTn9e8B6j4le+hUeSxuY6u5HuLdCU5gNkm8Fvwcw2h\n\t4KPE5xjj4sVDiLd8/1IzOWL5/+RJClS6pe81hSea7sz0tPwEehRfPLZxtrM3Wy09qboN\n\t8ZNJfvcygtJNs4OS2mjANxU55llEIUn6un1OkPHf2zDUC87XzM+z8Y/La4P8NgAeSugM\n\tlaG74KySbkH4aoFAgkoNOi6A0gTK0fQuEfqYcYbgyMUMi972tEx+4jjQcpNm7oAlA/GK\n\tjumg==",
            "i=1; a=rsa-sha256; t=1504878492; cv=none;\n\td=google.com; s=arc-20160816;\n\tb=mlt/tSar1zFF1/pcNf5CjoXYv82pHVytlpQpn4UoAoGyWSu1vyj5049osSfmfxdf0L\n\tfsEs/BWxj9CsM5OPjPIyfiWp2OhSbU7Y9wGego+ww/DXN5VExn+3bMaJPypFCLLK02Df\n\tSZB5bdojiTXXqV7urzggwc3kypY13FAra2BgfiUfhMCBaE6CIhkmoaqHT6vravP4KNx7\n\tuBLgPadxWksHqlZYzeN7qThUjUZNlblwYNO2tEGcSwx001YuVtI1/BmUh8qGw8Ht2PJD\n\ttSHAhb9i3KqQAuWssmd4PU8aVOhkog8/Y9kzDByd5HC4CAgEgFUep5hylwXPNNapGO6X\n\tkV3g=="
        ],
        "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:references:in-reply-to:message-id\n\t:date:subject:cc:to:from:arc-authentication-results\n\t:arc-message-signature:mime-version:sender:dkim-signature\n\t:arc-authentication-results;\n\tbh=oA1qkDWx+lFgdoPrQhIMRME4WHoJcT+0EQzYnP5b42M=;\n\tb=eoTGMCVFxRLSZxpC22cwFFDVKhizAPzmYDL5zCh3EesK2Chpbey9o5zZMBXJRY3gyn\n\tgG32rvG456P9dVoRfsJGAXwttEjgG0sMjZp4GgEz22zV9HUIIOY2QzXX5bf+3LjUwXQ5\n\t5cYaHgAf8EjFyjh7iuI9eEDUqpBVoKXxwt9EnOy2CjpAmvwJycXheqHXwTA6qXHMd1UR\n\tdT/hDEV7KPakVZ4FdMWJt9b+KMH+KJQ8Qo7I6N1LOSw4MKW6VxEG9unlSooYQOPlHDuE\n\t0lsjxpqS6wQVdt6oEJvh2p+xloSRj9q4ooTa0kycHGPopoK7U+n0orj7fjPaUHi1IHXg\n\tK0XA==",
            "i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com;\n\ts=arc-20160816; \n\th=references:in-reply-to:message-id:date:subject:cc:to:from\n\t:arc-authentication-results;\n\tbh=KHOxVtfw0Lz2nNF7ajnrSBSfgmQ8w1wUttPebtnGVW0=;\n\tb=LOBuxym0spyT4l6WSC6kVp1xMPXJL9FvbpIBsw5PavYsROzo7h2f6vm4rOVIzWolgO\n\t2jmnRRv0STUhRx3Iom5DNmAmb8fRLzQI/tWDEFbkGnySYcB+7CXK4UCnTJ2PNdljC1sC\n\tCVqHFvlqjydynSO+aEdnk5zvWq8Z2HflZz/NmARm2wdAP8w+IkMs/ENa48ljZSNmCBNC\n\tLlhLUFBErHQdp6xGRmw3pH6kVHy2NufBtPpDsUl95Aek9Vhdczpz8jf23flEp5GooDFl\n\tOaliFoVSfz2185S5D/d3qwAxSJQUWrWCzMzzlvuBjFsD9CdTIcKi3JU8cYb7LkXczmbA\n\tgzQw=="
        ],
        "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:mime-version:from:to:cc:subject:date:message-id:in-reply-to\n\t:references:x-original-sender:x-original-authentication-results\n\t:precedence:mailing-list:list-id:list-post:list-help:list-archive\n\t:list-subscribe:list-unsubscribe;\n\tbh=oA1qkDWx+lFgdoPrQhIMRME4WHoJcT+0EQzYnP5b42M=;\n\tb=b9B0H6dugpPf0//SBeZeLIn4Ornqy3uFO1tHbkvzVo0hMyHI1SjYsbgwYALOHFGGUL\n\tKOtq79ZpNorDqj8rF9uT7E9ZRhSdwYPGebQmTZL9f2GQaf7crLfGEG9uMTv4u7LmByHv\n\tc8jkJ4GmFVcaPtvmOmRqLFCpvMO3KUk0cbMzT3As3pFTzy+oMJrUTfQLL1LpBh/sNTzK\n\t9sHz89vWvtcCmRbukQ95kTTC/Ngtcs/fNnnyBy5KodulRSJ8UE6NgUL8I5Hm95031XS4\n\txUUwghjobcdjh8Xv/9FbuFAGMTiM/Y+Hi7Fo5y7I7aZbQccxThXSYdItHOFOwM0UWXhw\n\tEzhQ==",
        "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:mime-version:from:to:cc:subject:date\n\t:message-id:in-reply-to:references: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=oA1qkDWx+lFgdoPrQhIMRME4WHoJcT+0EQzYnP5b42M=;\n\tb=ul0RXGV28FfDfoYhIC+lEeJJJ/9MajWIwhB7IgtjaS0Vow1vsThOft2wJxlwAGun1y\n\tILpeC86kWocxIcIKCJLcuPOklA0MDCbpPkMHdgOFJzCo53arTTLytNGevYe78ACyiEKh\n\tucSWjGa6PDEIAEWG3tB19rpiQInYkhSCtQNn/XRmIuNhB/5THSntxnu9E4LHjHnfeg1C\n\trc5fW4252jEKlUzMbmT67dDnfDiUO/HHJlSLAzqt5VwUPeO7vll7GJ/YGSoFN3IBLQmF\n\tVuHfzYqEkAX0cNjc8Blhm220UygO1+CJYEOn8YwfVMbo2wi5umrWMp5mpXOeu0iTgOsL\n\trkPg==",
        "Sender": "swupdate@googlegroups.com",
        "X-Gm-Message-State": "AHPjjUiGbeKmsdnEA2xlr7cLUZsqLa+v+J7EZW7jx/uUj7XJRX62JMDP\n\tiLKyqT7B4A3JONSeH05S3mg=",
        "X-Google-Smtp-Source": "AOwi7QBPnRSw2FxaQrJ4MNWExq+0kDvQK1NCJpQIv06o4Y+JIcMUiRWCLoKY1IDGDHACI1jRUDtGTQ==",
        "X-Received": [
            "by 10.28.148.73 with SMTP id w70mr7889wmd.2.1504878493443;\n\tFri, 08 Sep 2017 06:48:13 -0700 (PDT)",
            "by 10.28.4.69 with SMTP id 66mr212298wme.25.1504878493018;\n\tFri, 08 Sep 2017 06:48:13 -0700 (PDT)"
        ],
        "MIME-Version": "1.0",
        "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; ",
        "From": "Christian Storm <christian.storm@siemens.com>",
        "To": "swupdate@googlegroups.com",
        "Cc": "Christian Storm <christian.storm@siemens.com>",
        "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\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",
        "Content-Type": "text/plain; charset=\"UTF-8\"",
        "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>"
    },
    "content": "Adapt the usages of former #define'd TMPDIR to\nmake use of get_tmpdir() instead.\n\nSigned-off-by: Christian Storm <christian.storm@siemens.com>\n---\n core/cpio_utils.c              |  1 +\n core/swupdate.c                | 16 ++++++++++++----\n corelib/installer.c            | 11 +++++++++--\n corelib/stream_interface.c     |  3 ++-\n handlers/archive_handler.c     |  9 ++++++++-\n handlers/boot_handler.c        |  1 +\n handlers/raw_handler.c         |  2 ++\n handlers/shell_scripthandler.c | 10 ++++++----\n include/globals.h              |  8 ++++----\n 9 files changed, 45 insertions(+), 16 deletions(-)",
    "diff": "diff --git a/core/cpio_utils.c b/core/cpio_utils.c\nindex c3df86f..e8651a3 100644\n--- a/core/cpio_utils.c\n+++ b/core/cpio_utils.c\n@@ -342,6 +342,7 @@ off_t extract_sw_description(int fd, const char *descfile, off_t start)\n \tchar output_file[64];\n \tuint32_t checksum;\n \tint fdout;\n+\tconst char* TMPDIR = get_tmpdir();\n \n \tif (extract_cpio_header(fd, &fdh, &offset)) {\n \t\tERROR(\"CPIO Header wrong\\n\");\ndiff --git a/core/swupdate.c b/core/swupdate.c\nindex 1f0ba0d..3057000 100644\n--- a/core/swupdate.c\n+++ b/core/swupdate.c\n@@ -305,7 +305,9 @@ static int install_from_file(char *fname, int check)\n \t\tpos);\n #endif\n \n-\tret = parse(&swcfg, TMPDIR SW_DESCRIPTION_FILENAME);\n+\tchar* swdescfilename = alloca(strlen(get_tmpdir())+strlen(SW_DESCRIPTION_FILENAME)+1);\n+\tsprintf(swdescfilename, \"%s%s\", get_tmpdir(), SW_DESCRIPTION_FILENAME);\n+\tret = parse(&swcfg, swdescfilename);\n \tif (ret) {\n \t\tERROR(\"failed to parse \" SW_DESCRIPTION_FILENAME \"!\\n\");\n \t\texit(1);\n@@ -394,6 +396,12 @@ static int parse_image_selector(const char *selector, struct swupdate_cfg *sw)\n \treturn 0;\n }\n \n+static void create_directory(const char* path) {\n+\tchar* dpath = alloca(strlen(get_tmpdir())+strlen(path)+1);\n+\tsprintf(dpath, \"%s%s\", get_tmpdir(), path);\n+\tmkdir(dpath, 0777);\n+}\n+\n static void swupdate_init(struct swupdate_cfg *sw)\n {\n \t/* Initialize internal tree to store configuration */\n@@ -407,9 +415,9 @@ static void swupdate_init(struct swupdate_cfg *sw)\n \n \n \t/* Create directories for scripts */\n-\tmkdir(SCRIPTS_DIR, 0777);\n-\tmkdir(DATASRC_DIR, 0777);\n-\tmkdir(DATADST_DIR, 0777);\n+\tcreate_directory(SCRIPTS_DIR_SUFFIX);\n+\tcreate_directory(DATASRC_DIR_SUFFIX);\n+\tcreate_directory(DATADST_DIR_SUFFIX);\n \n #ifdef CONFIG_MTD\n \tmtd_init();\ndiff --git a/corelib/installer.c b/corelib/installer.c\nindex ad0e0f1..8a188a1 100644\n--- a/corelib/installer.c\n+++ b/corelib/installer.c\n@@ -86,6 +86,7 @@ int check_if_required(struct imglist *list, struct filehdr *pfdh,\n \tint skip = SKIP_FILE;\n \tstruct img_type *img;\n \tint img_skip = 0;\n+\tconst char* TMPDIR = get_tmpdir();\n \n \t/*\n \t * Check that not more as one image wnat to be streamed\n@@ -204,7 +205,9 @@ static int update_bootloader_env(void)\n \tint ret = 0;\n \n \tTRACE(\"Updating bootloader environment\");\n-\tret = bootloader_apply_list((char *)BOOT_SCRIPT);\n+\tchar* bootscript = alloca(strlen(get_tmpdir())+strlen(BOOT_SCRIPT_SUFFIX)+1);\n+\tsprintf(bootscript, \"%s%s\", get_tmpdir(), BOOT_SCRIPT_SUFFIX);\n+\tret = bootloader_apply_list(bootscript);\n \tif (ret < 0)\n \t\tERROR(\"Error updating bootloader environment\");\n \n@@ -250,6 +253,7 @@ int install_images(struct swupdate_cfg *sw, int fdsw, int fromfile)\n \tchar filename[64];\n \tstruct filehdr fdh;\n \tstruct stat buf;\n+\tconst char* TMPDIR = get_tmpdir();\n \n \t/* Extract all scripts, preinstall scripts must be run now */\n \tif (fromfile) {\n@@ -268,7 +272,9 @@ int install_images(struct swupdate_cfg *sw, int fdsw, int fromfile)\n \t}\n \n \t/* Update u-boot environment */\n-\tret = prepare_boot_script(sw, BOOT_SCRIPT);\n+\tchar* bootscript = alloca(strlen(TMPDIR)+strlen(BOOT_SCRIPT_SUFFIX)+1);\n+\tsprintf(bootscript, \"%s%s\", TMPDIR, BOOT_SCRIPT_SUFFIX);\n+\tret = prepare_boot_script(sw, bootscript);\n \tif (ret) {\n \t\treturn ret;\n \t}\n@@ -377,6 +383,7 @@ void cleanup_files(struct swupdate_cfg *software) {\n \tstruct img_type *img;\n \tstruct dict_entry *bootvar;\n \tstruct hw_type *hw;\n+\tconst char* TMPDIR = get_tmpdir();\n \n \tLIST_FOREACH(img, &software->images, next) {\n \t\tif (img->fname[0]) {\ndiff --git a/corelib/stream_interface.c b/corelib/stream_interface.c\nindex 30e99ce..fb56c96 100644\n--- a/corelib/stream_interface.c\n+++ b/corelib/stream_interface.c\n@@ -89,6 +89,7 @@ static int extract_file_to_tmp(int fd, const char *fname, unsigned long *poffs)\n \tstruct filehdr fdh;\n \tint fdout;\n \tuint32_t checksum;\n+\tconst char* TMPDIR = get_tmpdir();\n \n \tif (extract_cpio_header(fd, &fdh, poffs)) {\n \t\treturn -1;\n@@ -135,7 +136,7 @@ static int extract_files(int fd, struct swupdate_cfg *software)\n \tint fdout;\n \tstruct img_type *img, *part;\n \tchar output_file[MAX_IMAGE_FNAME];\n-\n+\tconst char* TMPDIR = get_tmpdir();\n \n \t/* preset the info about the install parts */\n \ndiff --git a/handlers/archive_handler.c b/handlers/archive_handler.c\nindex 0568a41..f86d1f2 100644\n--- a/handlers/archive_handler.c\n+++ b/handlers/archive_handler.c\n@@ -34,7 +34,7 @@\n #include \"handler.h\"\n #include \"util.h\"\n \n-#define FIFO\tTMPDIR \"archivfifo\"\n+#define FIFO_FILE_NAME \"archivfifo\"\n \n /* Just to turn on during development */\n static int debug = 0;\n@@ -103,6 +103,8 @@ extract(void *p)\n \t * Enabling bzip2 is more expensive because the libbz2 library\n \t * isn't very well factored.\n \t */\n+\tchar* FIFO = alloca(strlen(get_tmpdir())+strlen(FIFO_FILE_NAME)+1);\n+\tsprintf(FIFO, \"%s%s\", get_tmpdir(), FIFO_FILE_NAME);\n \tif ((r = archive_read_open_filename(a, FIFO, 4096))) {\n \t\tERROR(\"archive_read_open_filename(): %s %d\\n\",\n \t\t    archive_error_string(a), r);\n@@ -154,6 +156,9 @@ static int install_archive_image(struct img_type *img,\n \tvoid *status;\n \tint use_mount = (strlen(img->device) && strlen(img->filesystem)) ? 1 : 0;\n \n+\tchar* DATADST_DIR = alloca(strlen(get_tmpdir())+strlen(DATADST_DIR_SUFFIX)+1);\n+\tsprintf(DATADST_DIR, \"%s%s\", get_tmpdir(), DATADST_DIR_SUFFIX);\n+\n \tpthread_attr_init(&attr);\n \tpthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);\n \n@@ -182,6 +187,8 @@ static int install_archive_image(struct img_type *img,\n \t\t}\n \t}\n \n+\tchar* FIFO = alloca(strlen(get_tmpdir())+strlen(FIFO_FILE_NAME)+1);\n+\tsprintf(FIFO, \"%s%s\", get_tmpdir(), FIFO_FILE_NAME);\n \tunlink(FIFO);\n \tret = mkfifo(FIFO, 0666);\n \tif (ret) {\ndiff --git a/handlers/boot_handler.c b/handlers/boot_handler.c\nindex f2d4aaf..41f87f7 100644\n--- a/handlers/boot_handler.c\n+++ b/handlers/boot_handler.c\n@@ -44,6 +44,7 @@ static int install_boot_environment(struct img_type *img,\n \tchar filename[64];\n \tstruct stat statbuf;\n \n+\tconst char* TMPDIR = get_tmpdir();\n \tif (snprintf(filename, sizeof(filename), \"%s%s\", TMPDIR,\n \t\t     img->fname) >= (int)sizeof(filename)) {\n \t\tERROR(\"Path too long: %s%s\", TMPDIR, img->fname);\ndiff --git a/handlers/raw_handler.c b/handlers/raw_handler.c\nindex 4b567fb..91e9bb7 100644\n--- a/handlers/raw_handler.c\n+++ b/handlers/raw_handler.c\n@@ -59,6 +59,8 @@ static int install_raw_file(struct img_type *img,\n \tint fdout;\n \tint ret = 0;\n \tint use_mount = (strlen(img->device) && strlen(img->filesystem)) ? 1 : 0;\n+\tchar* DATADST_DIR = alloca(strlen(get_tmpdir())+strlen(DATADST_DIR_SUFFIX)+1);\n+\tsprintf(DATADST_DIR, \"%s%s\", get_tmpdir(), DATADST_DIR_SUFFIX);\n \n \tif (strlen(img->path) == 0) {\n \t\tERROR(\"Missing path attribute\");\ndiff --git a/handlers/shell_scripthandler.c b/handlers/shell_scripthandler.c\nindex adda3ad..9095a5f 100644\n--- a/handlers/shell_scripthandler.c\n+++ b/handlers/shell_scripthandler.c\n@@ -40,17 +40,19 @@ static void shell_postinstall_handler(void);\n static int execute_shell_script(struct img_type *img, const char *fnname)\n {\n \tint ret;\n-\tchar shellscript[MAX_IMAGE_FNAME +\n-\t\tstrlen(SCRIPTS_DIR) + strlen(\"postinst\") + 2];\n+\tconst char* TMPDIR = get_tmpdir();\n+\n+\tchar shellscript[MAX_IMAGE_FNAME + strlen(TMPDIR) +\n+\t\tstrlen(SCRIPTS_DIR_SUFFIX) + strlen(\"postinst\") + 2];\n \n \tsnprintf(shellscript, sizeof(shellscript),\n-\t\t\"%s%s\", TMPDIR, img->fname);\n+\t\t\"%s%s%s\", TMPDIR, SCRIPTS_DIR_SUFFIX, img->fname);\n \tif (chmod(shellscript, S_IRUSR | S_IWUSR | S_IXUSR)) {\n \t\tERROR(\"Execution bit cannot be set for %s\", shellscript);\n \t\treturn -1;\n \t}\n \tsnprintf(shellscript, sizeof(shellscript),\n-\t\t\"%s%s %s\", TMPDIR, img->fname, fnname);\n+\t\t\"%s%s%s %s\", TMPDIR, SCRIPTS_DIR_SUFFIX, img->fname, fnname);\n \n \tret = system(shellscript);\n \tif (WIFEXITED(ret)) {\ndiff --git a/include/globals.h b/include/globals.h\nindex 9e0c2b9..6e87839 100644\n--- a/include/globals.h\n+++ b/include/globals.h\n@@ -34,10 +34,10 @@\n #define MAX_SEEK_STRING_SIZE\t32\n \n /* These are fixed path to temporary files */\n-#define SCRIPTS_DIR\tTMPDIR \"scripts/\"\n-#define DATASRC_DIR\tTMPDIR \"datasrc/\"\n-#define DATADST_DIR\tTMPDIR \"datadst/\"\n-#define BOOT_SCRIPT\tTMPDIR \"boot-script\"\n+#define SCRIPTS_DIR_SUFFIX\t\"scripts/\"\n+#define DATASRC_DIR_SUFFIX\t\"datasrc/\"\n+#define DATADST_DIR_SUFFIX\t\"datadst/\"\n+#define BOOT_SCRIPT_SUFFIX\t\"boot-script\"\n \n #endif\n \n",
    "prefixes": [
        "2/3"
    ]
}