get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 2224015,
    "url": "http://patchwork.ozlabs.org/api/patches/2224015/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/ltp/patch/20260416-stream_refactoring-v2-1-8321b1ec6f68@suse.com/",
    "project": {
        "id": 59,
        "url": "http://patchwork.ozlabs.org/api/projects/59/?format=api",
        "name": "Linux Test Project development",
        "link_name": "ltp",
        "list_id": "ltp.lists.linux.it",
        "list_email": "ltp@lists.linux.it",
        "web_url": "",
        "scm_url": "",
        "webscm_url": "",
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<20260416-stream_refactoring-v2-1-8321b1ec6f68@suse.com>",
    "list_archive_url": null,
    "date": "2026-04-16T14:33:35",
    "name": "[v2,1/7] lib: add safe macros for stream testing suite",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "bc4c717ec65dd41546a26edb7da1b6e6e59982f2",
    "submitter": {
        "id": 83220,
        "url": "http://patchwork.ozlabs.org/api/people/83220/?format=api",
        "name": "Andrea Cervesato",
        "email": "andrea.cervesato@suse.de"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/ltp/patch/20260416-stream_refactoring-v2-1-8321b1ec6f68@suse.com/mbox/",
    "series": [
        {
            "id": 500172,
            "url": "http://patchwork.ozlabs.org/api/series/500172/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/ltp/list/?series=500172",
            "date": "2026-04-16T14:33:35",
            "name": "Rewrite fs stream testing suite",
            "version": 2,
            "mbox": "http://patchwork.ozlabs.org/series/500172/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/2224015/comments/",
    "check": "warning",
    "checks": "http://patchwork.ozlabs.org/api/patches/2224015/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it>",
        "X-Original-To": [
            "incoming@patchwork.ozlabs.org",
            "ltp@lists.linux.it"
        ],
        "Delivered-To": [
            "patchwork-incoming@legolas.ozlabs.org",
            "ltp@picard.linux.it"
        ],
        "Authentication-Results": [
            "legolas.ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256\n header.s=susede2_rsa header.b=X2iPm859;\n\tdkim=fail reason=\"signature verification failed\" header.d=suse.de\n header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519\n header.b=3rZ4osMa;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key)\n header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa\n header.b=jWt3uv/Q;\n\tdkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256\n header.s=susede2_ed25519 header.b=eZWrxhi3;\n\tdkim-atps=neutral",
            "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=lists.linux.it\n (client-ip=213.254.12.146; helo=picard.linux.it;\n envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it;\n receiver=patchwork.ozlabs.org)",
            "smtp-out1.suse.de;\n\tnone"
        ],
        "Received": [
            "from picard.linux.it (picard.linux.it [213.254.12.146])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fxL9R6yXXz1yG9\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 17 Apr 2026 00:33:47 +1000 (AEST)",
            "from picard.linux.it (localhost [IPv6:::1])\n\tby picard.linux.it (Postfix) with ESMTP id 3D8593E4AD4\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 16 Apr 2026 16:33:44 +0200 (CEST)",
            "from in-4.smtp.seeweb.it (in-4.smtp.seeweb.it\n [IPv6:2001:4b78:1:20::4])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n key-exchange X25519 server-signature ECDSA (secp384r1))\n (No client certificate requested)\n by picard.linux.it (Postfix) with ESMTPS id 9D3EC3E1685\n for <ltp@lists.linux.it>; Thu, 16 Apr 2026 16:33:40 +0200 (CEST)",
            "from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest\n SHA256)\n (No client certificate requested)\n by in-4.smtp.seeweb.it (Postfix) with ESMTPS id 2D73E1000603\n for <ltp@lists.linux.it>; Thu, 16 Apr 2026 16:33:38 +0200 (CEST)",
            "from imap1.dmz-prg2.suse.org (unknown [10.150.64.97])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest\n SHA256)\n (No client certificate requested)\n by smtp-out1.suse.de (Postfix) with ESMTPS id C48C66A7EC;\n Thu, 16 Apr 2026 14:33:36 +0000 (UTC)",
            "from imap1.dmz-prg2.suse.org (localhost [127.0.0.1])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest\n SHA256)\n (No client certificate requested)\n by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 96382593A4;\n Thu, 16 Apr 2026 14:33:36 +0000 (UTC)",
            "from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167])\n by imap1.dmz-prg2.suse.org with ESMTPSA id 4PqJIkDz4GniGQAAD6G6ig\n (envelope-from <andrea.cervesato@suse.de>); Thu, 16 Apr 2026 14:33:36 +0000"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de;\n s=susede2_rsa;\n t=1776350017;\n h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:\n mime-version:mime-version:content-type:content-type:\n content-transfer-encoding:content-transfer-encoding:\n in-reply-to:in-reply-to:references:references;\n bh=0h/G41vZOBv7tkyijS8PxDV3cvBxEIW92pfiinxBaA8=;\n b=X2iPm859spCJqdvQxZccHChxHYhe8S0ag6OOEDXO+Or0xa6/msrCYZ79+xy1ZNxnoxcVGF\n oLkxZ4iWYiYWRkAQUih02+kN8pC4zK9GA6oZX6JSN+gWej6FPfU/xlyf/1Wrb0JwWqJuGI\n k0Ehe9rZozUVCxOKLbUAoWTgyeuAi9w=",
            "v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de;\n s=susede2_ed25519; t=1776350017;\n h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:\n mime-version:mime-version:content-type:content-type:\n content-transfer-encoding:content-transfer-encoding:\n in-reply-to:in-reply-to:references:references;\n bh=0h/G41vZOBv7tkyijS8PxDV3cvBxEIW92pfiinxBaA8=;\n b=3rZ4osMa8hRW2lURb2MxiHdzqpz1WaMzguhF9iyhpCj6mROeQWVWjJCuoU/orHyJrGgRjN\n Gmmm3lnsiA2xHsCw==",
            "v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de;\n s=susede2_rsa;\n t=1776350016;\n h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:\n mime-version:mime-version:content-type:content-type:\n content-transfer-encoding:content-transfer-encoding:\n in-reply-to:in-reply-to:references:references;\n bh=0h/G41vZOBv7tkyijS8PxDV3cvBxEIW92pfiinxBaA8=;\n b=jWt3uv/QFhX6Ge7FB8MwjZVbKfl3xvsQmgcDEw6UKmV0QEw4iZ0P0Vjl/titc23RVyFvnZ\n gv2CD4kS6gy4ls6f2io5EB1yORHbnA9YjWnj+YODu+uADDaVe+ZhoY19TTv3wedJ5eK3Ts\n 8d+vO3cSWWZe/i6eH0MlgZN2fDd3FaA=",
            "v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de;\n s=susede2_ed25519; t=1776350016;\n h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:\n mime-version:mime-version:content-type:content-type:\n content-transfer-encoding:content-transfer-encoding:\n in-reply-to:in-reply-to:references:references;\n bh=0h/G41vZOBv7tkyijS8PxDV3cvBxEIW92pfiinxBaA8=;\n b=eZWrxhi3b8iveouWDSpBYUqDrhwnZqgg1qVzxbK+gN9MhivcD5UkAglD54HY/RTQTU4mPK\n ikawJvaTf2PcVrDQ=="
        ],
        "From": "Andrea Cervesato <andrea.cervesato@suse.de>",
        "Date": "Thu, 16 Apr 2026 16:33:35 +0200",
        "MIME-Version": "1.0",
        "Message-Id": "<20260416-stream_refactoring-v2-1-8321b1ec6f68@suse.com>",
        "References": "<20260416-stream_refactoring-v2-0-8321b1ec6f68@suse.com>",
        "In-Reply-To": "<20260416-stream_refactoring-v2-0-8321b1ec6f68@suse.com>",
        "To": "Linux Test Project <ltp@lists.linux.it>",
        "X-Mailer": "b4 0.14.2",
        "X-Developer-Signature": "v=1; a=ed25519-sha256; t=1776350016; l=4993;\n i=andrea.cervesato@suse.com; s=20251210; h=from:subject:message-id;\n bh=d2vfPWFkSuh0KxbuI0eygCKqSQArqTWm5jp6e+q7wrE=;\n b=ftunuW9z3mew6xI8pUGAcvFz2lR7Tx2HfA2Z48sghm4lIJVwZiGFG2Gk31mA/oQ/0lHh450gF\n cGu19eDnUYHB/xHtL7JssunFawb/JpDF2uQZxgv5MZybwTygm7rt054",
        "X-Developer-Key": "i=andrea.cervesato@suse.com; a=ed25519;\n pk=zKY+6GCauOiuHNZ//d8PQ/UL4jFCTKbXrzXAOQSLevI=",
        "X-Spam-Score": "-4.30",
        "X-Spam-Level": "",
        "X-Spamd-Result": "default: False [-4.30 / 50.00]; BAYES_HAM(-3.00)[100.00%];\n NEURAL_HAM_LONG(-1.00)[-1.000];\n NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain];\n RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[];\n MIME_TRACE(0.00)[0:+]; FUZZY_RATELIMITED(0.00)[rspamd.com];\n RCVD_TLS_ALL(0.00)[];\n DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519];\n TO_DN_ALL(0.00)[]; FROM_HAS_DN(0.00)[];\n RCPT_COUNT_THREE(0.00)[3]; FROM_EQ_ENVFROM(0.00)[];\n TO_MATCH_ENVRCPT_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2];\n DBL_BLOCKED_OPENRESOLVER(0.00)[suse.com:mid, suse.com:email,\n imap1.dmz-prg2.suse.org:helo, suse.cz:email]",
        "X-Spam-Status": "No, score=0.1 required=7.0 tests=DKIM_SIGNED,DKIM_VALID,\n DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS shortcircuit=no\n autolearn=disabled version=4.0.1",
        "X-Spam-Checker-Version": "SpamAssassin 4.0.1 (2024-03-25) on in-4.smtp.seeweb.it",
        "X-Virus-Scanned": "clamav-milter 1.0.9 at in-4.smtp.seeweb.it",
        "X-Virus-Status": "Clean",
        "Subject": "[LTP] [PATCH v2 1/7] lib: add safe macros for stream testing suite",
        "X-BeenThere": "ltp@lists.linux.it",
        "X-Mailman-Version": "2.1.29",
        "Precedence": "list",
        "List-Id": "Linux Test Project <ltp.lists.linux.it>",
        "List-Unsubscribe": "<https://lists.linux.it/options/ltp>,\n <mailto:ltp-request@lists.linux.it?subject=unsubscribe>",
        "List-Archive": "<http://lists.linux.it/pipermail/ltp/>",
        "List-Post": "<mailto:ltp@lists.linux.it>",
        "List-Help": "<mailto:ltp-request@lists.linux.it?subject=help>",
        "List-Subscribe": "<https://lists.linux.it/listinfo/ltp>,\n <mailto:ltp-request@lists.linux.it?subject=subscribe>",
        "Content-Type": "text/plain; charset=\"us-ascii\"",
        "Content-Transfer-Encoding": "7bit",
        "Errors-To": "ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it",
        "Sender": "\"ltp\" <ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it>"
    },
    "content": "From: Andrea Cervesato <andrea.cervesato@suse.com>\n\nIntroduce the following SAFE_* macros for stream file testing:\n\n- SAFE_FREAD\n- SAFE_FWRITE\n- SAFE_FREOPEN\n- SAFE_FSEEK\n- SAFE_FTELL\n- SAFE_FILENO\n- SAFE_FFLUSH\n\nReviewed-by: Cyril Hrubis <chrubis@suse.cz>\nSigned-off-by: Andrea Cervesato <andrea.cervesato@suse.com>\n---\n include/safe_stdio_fn.h  |  21 ++++++++++\n include/tst_safe_stdio.h |  21 ++++++++++\n lib/safe_stdio.c         | 101 +++++++++++++++++++++++++++++++++++++++++++++++\n 3 files changed, 143 insertions(+)",
    "diff": "diff --git a/include/safe_stdio_fn.h b/include/safe_stdio_fn.h\nindex 3818a86571a6d9bc63fcf432c93683bb3298e5b2..255a85949749748533e93b86c7cf170900e95082 100644\n--- a/include/safe_stdio_fn.h\n+++ b/include/safe_stdio_fn.h\n@@ -32,4 +32,25 @@ int safe_asprintf(const char *file, const int lineno, void (cleanup_fn)(void),\n FILE *safe_popen(const char *file, const int lineno, void (cleanup_fn)(void),\n \t\t const char *command, const char *type);\n \n+size_t safe_fread(const char *file, const int lineno,\n+\t\t  void *ptr, size_t size, size_t n, FILE *stream);\n+\n+size_t safe_fwrite(const char *file, const int lineno,\n+\t\t   const void *ptr, size_t size, size_t n, FILE *stream);\n+\n+FILE *safe_freopen(const char *file, const int lineno,\n+\t\t   const char *path, const char *mode, FILE *stream);\n+\n+int safe_fseek(const char *file, const int lineno,\n+\t       FILE *f, long offset, int whence);\n+\n+long safe_ftell(const char *file, const int lineno,\n+\t\tFILE *f);\n+\n+int safe_fileno(const char *file, const int lineno,\n+\t\tFILE *stream);\n+\n+int safe_fflush(const char *file, const int lineno,\n+\t\tFILE *stream);\n+\n #endif /* SAFE_STDIO_FN_H__ */\ndiff --git a/include/tst_safe_stdio.h b/include/tst_safe_stdio.h\nindex e4bff34da15c9116809fcf851cbf544a51e384ef..45d4bc7e5d590468eec7a95b0aa37019e4e15f18 100644\n--- a/include/tst_safe_stdio.h\n+++ b/include/tst_safe_stdio.h\n@@ -21,4 +21,25 @@\n #define SAFE_POPEN(command, type) \\\n \tsafe_popen(__FILE__, __LINE__, NULL, command, type)\n \n+#define SAFE_FREAD(ptr, size, n, stream) \\\n+\tsafe_fread(__FILE__, __LINE__, ptr, size, n, stream)\n+\n+#define SAFE_FWRITE(ptr, size, n, stream) \\\n+\tsafe_fwrite(__FILE__, __LINE__, ptr, size, n, stream)\n+\n+#define SAFE_FREOPEN(path, mode, stream) \\\n+\tsafe_freopen(__FILE__, __LINE__, path, mode, stream)\n+\n+#define SAFE_FSEEK(f, offset, whence) \\\n+\tsafe_fseek(__FILE__, __LINE__, f, offset, whence)\n+\n+#define SAFE_FTELL(f) \\\n+\tsafe_ftell(__FILE__, __LINE__, f)\n+\n+#define SAFE_FILENO(f) \\\n+\tsafe_fileno(__FILE__, __LINE__, f)\n+\n+#define SAFE_FFLUSH(f) \\\n+\tsafe_fflush(__FILE__, __LINE__, f)\n+\n #endif /* TST_SAFE_STDIO_H__ */\ndiff --git a/lib/safe_stdio.c b/lib/safe_stdio.c\nindex ab23e43bb0835cdca5eaa015bc873fd23f9a8408..feb8a4b5c87c8b2cb7f7f59f6ba763e45acdf237 100644\n--- a/lib/safe_stdio.c\n+++ b/lib/safe_stdio.c\n@@ -99,3 +99,104 @@ FILE *safe_popen(const char *file, const int lineno, void (cleanup_fn)(void),\n \n \treturn stream;\n }\n+\n+size_t safe_fread(const char *file, const int lineno,\n+\tvoid *ptr, size_t size, size_t n, FILE *stream)\n+{\n+\tsize_t ret;\n+\n+\tret = fread(ptr, size, n, stream);\n+\tif (ret != n) {\n+\t\ttst_brkm_(file, lineno, TBROK, NULL,\n+\t\t\t\"fread(%p, %lu, %lu, %p) read %lu bytes\",\n+\t\t\tptr, size, n, stream, ret);\n+\t}\n+\n+\treturn ret;\n+}\n+\n+size_t safe_fwrite(const char *file, const int lineno,\n+\tconst void *ptr, size_t size, size_t n, FILE *stream)\n+{\n+\tsize_t ret;\n+\n+\tret = fwrite(ptr, size, n, stream);\n+\tif (ret != n) {\n+\t\ttst_brkm_(file, lineno, TBROK, NULL,\n+\t\t\t\"fwrite(%p, %lu, %lu, %p) written %lu bytes\",\n+\t\t\tptr, size, n, stream, ret);\n+\t}\n+\n+\treturn ret;\n+}\n+\n+FILE *safe_freopen(const char *file, const int lineno,\n+\t       const char *path, const char *mode, FILE *stream)\n+{\n+\tFILE *f = freopen(path, mode, stream);\n+\n+\tif (!f) {\n+\t\ttst_brkm_(file, lineno, TBROK | TERRNO, NULL,\n+\t\t\t\"freopen(%s,%s,%p) failed\", path, mode, stream);\n+\t}\n+\n+\treturn f;\n+}\n+\n+int safe_fseek(const char *file, const int lineno,\n+\t\t   FILE *f, long offset, int whence)\n+{\n+\tint ret;\n+\n+\terrno = 0;\n+\tret = fseek(f, offset, whence);\n+\n+\tif (ret == -1) {\n+\t\ttst_brkm_(file, lineno, TBROK | TERRNO, NULL,\n+\t\t\t\"fseek(%p, %ld, %d)\", f, offset, whence);\n+\t}\n+\n+\treturn ret;\n+}\n+\n+long safe_ftell(const char *file, const int lineno,\n+\t       FILE *f)\n+{\n+\tlong ret;\n+\n+\terrno = 0;\n+\tret = ftell(f);\n+\n+\tif (ret == -1)\n+\t\ttst_brkm_(file, lineno, TBROK | TERRNO, NULL, \"ftell(%p)\", f);\n+\n+\treturn ret;\n+}\n+\n+int safe_fileno(const char *file, const int lineno,\n+\t\tFILE *f)\n+{\n+\tint ret;\n+\n+\terrno = 0;\n+\tret = fileno(f);\n+\n+\tif (ret == -1)\n+\t\ttst_brkm_(file, lineno, TBROK | TERRNO, NULL, \"fileno(%p)\", f);\n+\n+\treturn ret;\n+}\n+\n+int safe_fflush(const char *file, const int lineno,\n+\t\tFILE *f)\n+{\n+\tint ret;\n+\n+\terrno = 0;\n+\tret = fflush(f);\n+\n+\tif (ret == EOF)\n+\t\ttst_brkm_(file, lineno, TBROK | TERRNO, NULL, \"fflush(%p)\", f);\n+\n+\treturn ret;\n+}\n",
    "prefixes": [
        "v2",
        "1/7"
    ]
}