Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/808817/?format=api
{ "id": 808817, "url": "http://patchwork.ozlabs.org/api/patches/808817/?format=api", "web_url": "http://patchwork.ozlabs.org/project/netdev/patch/20170901165256.21459-2-phil@nwl.cc/", "project": { "id": 7, "url": "http://patchwork.ozlabs.org/api/projects/7/?format=api", "name": "Linux network development", "link_name": "netdev", "list_id": "netdev.vger.kernel.org", "list_email": "netdev@vger.kernel.org", "web_url": null, "scm_url": null, "webscm_url": null, "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<20170901165256.21459-2-phil@nwl.cc>", "list_archive_url": null, "date": "2017-09-01T16:52:51", "name": "[iproute,1/6] utils: Implement strlcpy() and strlcat()", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": true, "hash": "23a49277d92e88727ba4502518a6d2238e742193", "submitter": { "id": 4285, "url": "http://patchwork.ozlabs.org/api/people/4285/?format=api", "name": "Phil Sutter", "email": "phil@nwl.cc" }, "delegate": { "id": 389, "url": "http://patchwork.ozlabs.org/api/users/389/?format=api", "username": "shemminger", "first_name": "stephen", "last_name": "hemminger", "email": "shemminger@vyatta.com" }, "mbox": "http://patchwork.ozlabs.org/project/netdev/patch/20170901165256.21459-2-phil@nwl.cc/mbox/", "series": [ { "id": 1076, "url": "http://patchwork.ozlabs.org/api/series/1076/?format=api", "web_url": "http://patchwork.ozlabs.org/project/netdev/list/?series=1076", "date": "2017-09-01T16:52:50", "name": "strlcpy() and strlcat() for iproute2", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/1076/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/808817/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/808817/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<netdev-owner@vger.kernel.org>", "X-Original-To": "patchwork-incoming@ozlabs.org", "Delivered-To": "patchwork-incoming@ozlabs.org", "Authentication-Results": "ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=vger.kernel.org\n\t(client-ip=209.132.180.67; helo=vger.kernel.org;\n\tenvelope-from=netdev-owner@vger.kernel.org;\n\treceiver=<UNKNOWN>)", "Received": [ "from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3xkQKn6H7fz9t2x\n\tfor <patchwork-incoming@ozlabs.org>;\n\tSat, 2 Sep 2017 02:53:17 +1000 (AEST)", "(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1752131AbdIAQxP (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tFri, 1 Sep 2017 12:53:15 -0400", "from orbyte.nwl.cc ([151.80.46.58]:41345 \"EHLO mail.nwl.cc\"\n\trhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP\n\tid S1751863AbdIAQxP (ORCPT <rfc822;netdev@vger.kernel.org>);\n\tFri, 1 Sep 2017 12:53:15 -0400", "from mail.nwl.cc (orbyte.nwl.cc [127.0.0.1])\n\tby mail.nwl.cc (Postfix) with ESMTP id 40F7D65A5E;\n\tFri, 1 Sep 2017 18:53:14 +0200 (CEST)", "from xsao (localhost [IPv6:::1])\n\tby mail.nwl.cc (Postfix) with ESMTP id 2237B644CF;\n\tFri, 1 Sep 2017 18:53:14 +0200 (CEST)" ], "From": "Phil Sutter <phil@nwl.cc>", "To": "Stephen Hemminger <stephen@networkplumber.org>", "Cc": "netdev@vger.kernel.org", "Subject": "[iproute PATCH 1/6] utils: Implement strlcpy() and strlcat()", "Date": "Fri, 1 Sep 2017 18:52:51 +0200", "Message-Id": "<20170901165256.21459-2-phil@nwl.cc>", "X-Mailer": "git-send-email 2.13.1", "In-Reply-To": "<20170901165256.21459-1-phil@nwl.cc>", "References": "<20170901165256.21459-1-phil@nwl.cc>", "X-Virus-Scanned": "ClamAV using ClamSMTP", "Sender": "netdev-owner@vger.kernel.org", "Precedence": "bulk", "List-ID": "<netdev.vger.kernel.org>", "X-Mailing-List": "netdev@vger.kernel.org" }, "content": "By making use of strncpy(), both implementations are really simple so\nthere is no need to add libbsd as additional dependency.\n\nSigned-off-by: Phil Sutter <phil@nwl.cc>\n---\n include/utils.h | 3 +++\n lib/utils.c | 19 +++++++++++++++++++\n 2 files changed, 22 insertions(+)", "diff": "diff --git a/include/utils.h b/include/utils.h\nindex f665d9001806f..9c2f9fc257fba 100644\n--- a/include/utils.h\n+++ b/include/utils.h\n@@ -252,4 +252,7 @@ int make_path(const char *path, mode_t mode);\n char *find_cgroup2_mount(void);\n int get_command_name(const char *pid, char *comm, size_t len);\n \n+size_t strlcpy(char *dst, const char *src, size_t size);\n+size_t strlcat(char *dst, const char *src, size_t size);\n+\n #endif /* __UTILS_H__ */\ndiff --git a/lib/utils.c b/lib/utils.c\nindex 002063075fd61..c95780e725252 100644\n--- a/lib/utils.c\n+++ b/lib/utils.c\n@@ -1238,3 +1238,22 @@ int get_real_family(int rtm_type, int rtm_family)\n \n \treturn rtm_family;\n }\n+\n+size_t strlcpy(char *dst, const char *src, size_t size)\n+{\n+\tif (size) {\n+\t\tstrncpy(dst, src, size - 1);\n+\t\tdst[size - 1] = '\\0';\n+\t}\n+\treturn strlen(src);\n+}\n+\n+size_t strlcat(char *dst, const char *src, size_t size)\n+{\n+\tsize_t dlen = strlen(dst);\n+\n+\tif (dlen > size)\n+\t\treturn dlen + strlen(src);\n+\n+\treturn dlen + strlcpy(dst + dlen, src, size - dlen);\n+}\n", "prefixes": [ "iproute", "1/6" ] }