get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 34879,
    "url": "http://patches.dpdk.org/api/patches/34879/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20180202120058.243184-1-bruce.richardson@intel.com/",
    "project": {
        "id": 1,
        "url": "http://patches.dpdk.org/api/projects/1/?format=api",
        "name": "DPDK",
        "link_name": "dpdk",
        "list_id": "dev.dpdk.org",
        "list_email": "dev@dpdk.org",
        "web_url": "http://core.dpdk.org",
        "scm_url": "git://dpdk.org/dpdk",
        "webscm_url": "http://git.dpdk.org/dpdk",
        "list_archive_url": "https://inbox.dpdk.org/dev",
        "list_archive_url_format": "https://inbox.dpdk.org/dev/{}",
        "commit_url_format": ""
    },
    "msgid": "<20180202120058.243184-1-bruce.richardson@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20180202120058.243184-1-bruce.richardson@intel.com",
    "date": "2018-02-02T12:00:58",
    "name": "[dpdk-dev] pmdinfogen: fix resource leak of FILE object",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "ec876bd072d2300ce6d750d5f168fe8b160cadd9",
    "submitter": {
        "id": 20,
        "url": "http://patches.dpdk.org/api/people/20/?format=api",
        "name": "Bruce Richardson",
        "email": "bruce.richardson@intel.com"
    },
    "delegate": {
        "id": 1,
        "url": "http://patches.dpdk.org/api/users/1/?format=api",
        "username": "tmonjalo",
        "first_name": "Thomas",
        "last_name": "Monjalon",
        "email": "thomas@monjalon.net"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/20180202120058.243184-1-bruce.richardson@intel.com/mbox/",
    "series": [],
    "comments": "http://patches.dpdk.org/api/patches/34879/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/34879/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@dpdk.org",
        "Delivered-To": "patchwork@dpdk.org",
        "Received": [
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id BFCBAA499;\n\tFri,  2 Feb 2018 13:01:35 +0100 (CET)",
            "from mga02.intel.com (mga02.intel.com [134.134.136.20])\n\tby dpdk.org (Postfix) with ESMTP id E41F17CEA\n\tfor <dev@dpdk.org>; Fri,  2 Feb 2018 13:01:33 +0100 (CET)",
            "from fmsmga008.fm.intel.com ([10.253.24.58])\n\tby orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t02 Feb 2018 04:01:32 -0800",
            "from silpixa00399126.ir.intel.com (HELO\n\tsilpixa00399126.ger.corp.intel.com) ([10.237.223.223])\n\tby fmsmga008.fm.intel.com with ESMTP; 02 Feb 2018 04:01:31 -0800"
        ],
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "X-Amp-File-Uploaded": "False",
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.46,448,1511856000\"; d=\"scan'208\";a=\"14949105\"",
        "From": "Bruce Richardson <bruce.richardson@intel.com>",
        "To": "Neil Horman <nhorman@tuxdriver.com>",
        "Cc": "dev@dpdk.org,\n\tBruce Richardson <bruce.richardson@intel.com>",
        "Date": "Fri,  2 Feb 2018 12:00:58 +0000",
        "Message-Id": "<20180202120058.243184-1-bruce.richardson@intel.com>",
        "X-Mailer": "git-send-email 2.14.3",
        "Subject": "[dpdk-dev] [PATCH] pmdinfogen: fix resource leak of FILE object",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.15",
        "Precedence": "list",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "List-Unsubscribe": "<https://dpdk.org/ml/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "List-Archive": "<http://dpdk.org/ml/archives/dev/>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "List-Subscribe": "<https://dpdk.org/ml/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "Coverity flags an issue where the resources used by the FILE object for\nthe temporary input file are leaked. This is a very minor issue, but is\neasily fixed, while also avoiding later problems where we try to close\nan invalid file descriptor in the failure case.\n\nThe fix is to use \"dup()\" to get a new file descriptor number rather than\nusing the value directly from fileno. This allows us to close the file\nopened with tmpfile() within in scope block, while allowing the duplicate\nto pass to the outer block and be closed when the function terminates.\n\nAs a side-effect I/O in the function is therefore changed from using stdio\nfread/fwrite to read/write system calls.\n\nCoverity issue: 260399\nFixes: 0d68533617e3 (\"pmdinfogen: allow using stdin and stdout\")\n\nSigned-off-by: Bruce Richardson <bruce.richardson@intel.com>\n---\n buildtools/pmdinfogen/pmdinfogen.c | 16 ++++++++++------\n 1 file changed, 10 insertions(+), 6 deletions(-)",
    "diff": "diff --git a/buildtools/pmdinfogen/pmdinfogen.c b/buildtools/pmdinfogen/pmdinfogen.c\nindex 45b267346..0f35ca46b 100644\n--- a/buildtools/pmdinfogen/pmdinfogen.c\n+++ b/buildtools/pmdinfogen/pmdinfogen.c\n@@ -50,20 +50,24 @@ static void *grab_file(const char *filename, unsigned long *size)\n \t\t/* from stdin, use a temporary file to mmap */\n \t\tFILE *infile;\n \t\tchar buffer[1024];\n-\t\tsize_t n;\n+\t\tint n;\n \n \t\tinfile = tmpfile();\n \t\tif (infile == NULL) {\n \t\t\tperror(\"tmpfile\");\n \t\t\treturn NULL;\n \t\t}\n-\t\twhile (!feof(stdin)) {\n-\t\t\tn = fread(buffer, 1, sizeof(buffer), stdin);\n-\t\t\tif (fwrite(buffer, 1, n, infile) != n)\n+\t\tfd = dup(fileno(infile));\n+\t\tfclose(infile);\n+\t\tif (fd < 0)\n+\t\t\treturn NULL;\n+\n+\t\tn = read(STDIN_FILENO, buffer, sizeof(buffer));\n+\t\twhile (n > 0) {\n+\t\t\tif (write(fd, buffer, n) != n)\n \t\t\t\tgoto failed;\n+\t\t\tn = read(STDIN_FILENO, buffer, sizeof(buffer));\n \t\t}\n-\t\tfflush(infile);\n-\t\tfd = fileno(infile);\n \t}\n \n \tif (fstat(fd, &st))\n",
    "prefixes": [
        "dpdk-dev"
    ]
}