get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 809773,
    "url": "http://patchwork.ozlabs.org/api/patches/809773/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/glibc/patch/20170904173123.9C550439942E3@oldenburg.str.redhat.com/",
    "project": {
        "id": 41,
        "url": "http://patchwork.ozlabs.org/api/projects/41/?format=api",
        "name": "GNU C Library",
        "link_name": "glibc",
        "list_id": "libc-alpha.sourceware.org",
        "list_email": "libc-alpha@sourceware.org",
        "web_url": "",
        "scm_url": "",
        "webscm_url": "",
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<20170904173123.9C550439942E3@oldenburg.str.redhat.com>",
    "list_archive_url": null,
    "date": "2017-09-04T17:31:23",
    "name": "nss_files: Use struct scratch_buffer for gethostbyname [BZ #18023]",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "f7b90e612456057ae69b34780acee65de53e5f04",
    "submitter": {
        "id": 14312,
        "url": "http://patchwork.ozlabs.org/api/people/14312/?format=api",
        "name": "Florian Weimer",
        "email": "fweimer@redhat.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/glibc/patch/20170904173123.9C550439942E3@oldenburg.str.redhat.com/mbox/",
    "series": [
        {
            "id": 1428,
            "url": "http://patchwork.ozlabs.org/api/series/1428/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/glibc/list/?series=1428",
            "date": "2017-09-04T17:31:23",
            "name": "nss_files: Use struct scratch_buffer for gethostbyname [BZ #18023]",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/1428/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/809773/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/809773/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<libc-alpha-return-84173-incoming=patchwork.ozlabs.org@sourceware.org>",
        "X-Original-To": "incoming@patchwork.ozlabs.org",
        "Delivered-To": [
            "patchwork-incoming@bilbo.ozlabs.org",
            "mailing list libc-alpha@sourceware.org"
        ],
        "Authentication-Results": [
            "ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=sourceware.org\n\t(client-ip=209.132.180.131; helo=sourceware.org;\n\tenvelope-from=libc-alpha-return-84173-incoming=patchwork.ozlabs.org@sourceware.org;\n\treceiver=<UNKNOWN>)",
            "ozlabs.org; dkim=pass (1024-bit key;\n\tsecure) header.d=sourceware.org header.i=@sourceware.org\n\theader.b=\"HuWpxpsi\"; dkim-atps=neutral",
            "sourceware.org; auth=none",
            "ext-mx03.extmail.prod.ext.phx2.redhat.com;\n\tdmarc=none (p=none dis=none) header.from=redhat.com",
            "ext-mx03.extmail.prod.ext.phx2.redhat.com;\n\tspf=fail smtp.mailfrom=fweimer@redhat.com"
        ],
        "Received": [
            "from sourceware.org (server1.sourceware.org [209.132.180.131])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xmH2g3mQMz9t32\n\tfor <incoming@patchwork.ozlabs.org>;\n\tTue,  5 Sep 2017 03:31:39 +1000 (AEST)",
            "(qmail 124742 invoked by alias); 4 Sep 2017 17:31:30 -0000",
            "(qmail 124295 invoked by uid 89); 4 Sep 2017 17:31:30 -0000"
        ],
        "DomainKey-Signature": "a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id\n\t:list-unsubscribe:list-subscribe:list-archive:list-post\n\t:list-help:sender:date:to:subject:mime-version:content-type\n\t:content-transfer-encoding:message-id:from; q=dns; s=default; b=\n\tLIakNDftGac6rXcxrsRKjNkS3zplemkvRgZvG3EeLjNpMPpa4kelCUCl3RbhGAPm\n\tf2b16UrhLNCopA8qvzXRO9U7lt0mvFiRC9KXiQufq5gaPm+4YM5lqv4myxQ25Zb1\n\tKPYPnrPsWBte17RhbavLQfkPzZFPyxgl+qyM+OtoIGo=",
        "DKIM-Signature": "v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id\n\t:list-unsubscribe:list-subscribe:list-archive:list-post\n\t:list-help:sender:date:to:subject:mime-version:content-type\n\t:content-transfer-encoding:message-id:from; s=default; bh=60MAQl\n\t0ILsreO8qL4elI93T2Moc=; b=HuWpxpsiS1Ab5Br2WCX+Fi7yy27dYAxFnVCbsB\n\tjJkdmD9pVWuEPLKNkz3Kp3DKAdP8AzvuNKUEC0xre4APXFR8cC7uOu9RnoI8VqJ8\n\tZEH/xLQGZET12INdvlzNAUEzck04gKZOyu74hP/1iRUFUoaT6AArLcYi/5oPa7rj\n\tD0Kl0=",
        "Mailing-List": "contact libc-alpha-help@sourceware.org; run by ezmlm",
        "Precedence": "bulk",
        "List-Id": "<libc-alpha.sourceware.org>",
        "List-Unsubscribe": "<mailto:libc-alpha-unsubscribe-incoming=patchwork.ozlabs.org@sourceware.org>",
        "List-Subscribe": "<mailto:libc-alpha-subscribe@sourceware.org>",
        "List-Archive": "<http://sourceware.org/ml/libc-alpha/>",
        "List-Post": "<mailto:libc-alpha@sourceware.org>",
        "List-Help": "<mailto:libc-alpha-help@sourceware.org>,\n\t<http://sourceware.org/ml/#faqs>",
        "Sender": "libc-alpha-owner@sourceware.org",
        "X-Virus-Found": "No",
        "X-Spam-SWARE-Status": "No, score=-24.1 required=5.0 tests=BAYES_00, GIT_PATCH_0,\n\tGIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RP_MATCHES_RCVD,\n\tSPF_HELO_PASS,\n\tUNWANTED_LANGUAGE_BODY autolearn=ham version=3.3.2 spammy=",
        "X-HELO": "mx1.redhat.com",
        "DMARC-Filter": "OpenDMARC Filter v1.3.2 mx1.redhat.com 7F11E2C8A",
        "Date": "Mon, 04 Sep 2017 19:31:23 +0200",
        "To": "libc-alpha@sourceware.org",
        "Subject": "[PATCH] nss_files: Use struct scratch_buffer for gethostbyname\n\t[BZ #18023]",
        "User-Agent": "Heirloom mailx 12.5 7/5/10",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=us-ascii",
        "Content-Transfer-Encoding": "7bit",
        "Message-Id": "<20170904173123.9C550439942E3@oldenburg.str.redhat.com>",
        "From": "fweimer@redhat.com (Florian Weimer)"
    },
    "content": "2017-09-04  Florian Weimer  <fweimer@redhat.com>\n\n\t[BZ #18023]\n\t* nss/nss_files/files-hosts.c (gethostbyname3_multi): Use struct\n\tscratch_buffer.",
    "diff": "diff --git a/nss/nss_files/files-hosts.c b/nss/nss_files/files-hosts.c\nindex 867c10c2ef..c2cd07584c 100644\n--- a/nss/nss_files/files-hosts.c\n+++ b/nss/nss_files/files-hosts.c\n@@ -22,6 +22,7 @@\n #include <arpa/nameser.h>\n #include <netdb.h>\n #include <resolv/resolv-internal.h>\n+#include <scratch_buffer.h>\n \n \n /* Get implementation for some internal functions.  */\n@@ -121,15 +122,12 @@ gethostbyname3_multi (FILE * stream, const char *name, int af,\n \t\t      int *errnop, int *herrnop, int flags)\n {\n   /* We have to get all host entries from the file.  */\n-  size_t tmp_buflen = MIN (buflen, 4096);\n-  char tmp_buffer_stack[tmp_buflen]\n-    __attribute__ ((__aligned__ (__alignof__ (struct hostent_data))));\n-  char *tmp_buffer = tmp_buffer_stack;\n+  struct scratch_buffer tmp_buffer;\n+  scratch_buffer_init (&tmp_buffer);\n   struct hostent tmp_result_buf;\n   int naddrs = 1;\n   int naliases = 0;\n   char *bufferend;\n-  bool tmp_buffer_malloced = false;\n   enum nss_status status;\n \n   while (result->h_aliases[naliases] != NULL)\n@@ -138,8 +136,8 @@ gethostbyname3_multi (FILE * stream, const char *name, int af,\n   bufferend = (char *) &result->h_aliases[naliases + 1];\n \n  again:\n-  while ((status = internal_getent (stream, &tmp_result_buf, tmp_buffer,\n-\t\t\t\t    tmp_buflen, errnop, herrnop, af,\n+  while ((status = internal_getent (stream, &tmp_result_buf, tmp_buffer.data,\n+\t\t\t\t    tmp_buffer.length, errnop, herrnop, af,\n \t\t\t\t    flags))\n \t == NSS_STATUS_SUCCESS)\n     {\n@@ -266,52 +264,18 @@ gethostbyname3_multi (FILE * stream, const char *name, int af,\n \n   if (status == NSS_STATUS_TRYAGAIN)\n     {\n-      size_t newsize = 2 * tmp_buflen;\n-      if (tmp_buffer_malloced)\n+      if (!scratch_buffer_grow (&tmp_buffer))\n \t{\n-\t  char *newp = realloc (tmp_buffer, newsize);\n-\t  if (newp != NULL)\n-\t    {\n-\t      assert ((((uintptr_t) newp)\n-\t\t       & (__alignof__ (struct hostent_data) - 1))\n-\t\t      == 0);\n-\t      tmp_buffer = newp;\n-\t      tmp_buflen = newsize;\n-\t      goto again;\n-\t    }\n-\t}\n-      else if (!__libc_use_alloca (buflen + newsize))\n-\t{\n-\t  tmp_buffer = malloc (newsize);\n-\t  if (tmp_buffer != NULL)\n-\t    {\n-\t      assert ((((uintptr_t) tmp_buffer)\n-\t\t       & (__alignof__ (struct hostent_data) - 1))\n-\t\t      == 0);\n-\t      tmp_buffer_malloced = true;\n-\t      tmp_buflen = newsize;\n-\t      goto again;\n-\t    }\n+\t  *herrnop = NETDB_INTERNAL;\n+\t  status = NSS_STATUS_TRYAGAIN;\n \t}\n       else\n-\t{\n-\t  tmp_buffer\n-\t    = extend_alloca (tmp_buffer, tmp_buflen,\n-\t\t\t     newsize\n-\t\t\t     + __alignof__ (struct hostent_data));\n-\t  tmp_buffer = (char *) (((uintptr_t) tmp_buffer\n-\t\t\t\t  + __alignof__ (struct hostent_data)\n-\t\t\t\t  - 1)\n-\t\t\t\t & ~(__alignof__ (struct hostent_data)\n-\t\t\t\t     - 1));\n-\t  goto again;\n-\t}\n+\tgoto again;\n     }\n   else\n     status = NSS_STATUS_SUCCESS;\n  out:\n-  if (tmp_buffer_malloced)\n-    free (tmp_buffer);\n+  scratch_buffer_free (&tmp_buffer);\n   return status;\n }\n \n",
    "prefixes": []
}