From patchwork Wed Jun 24 13:29:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Daniel_Gr=C3=B6ber?= X-Patchwork-Id: 1316225 X-Patchwork-Delegate: pablo@netfilter.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=netfilter-devel-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=darkboxed.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 49sPCY0VhJz9sTC for ; Wed, 24 Jun 2020 23:30:17 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2403935AbgFXNaM (ORCPT ); Wed, 24 Jun 2020 09:30:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41226 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389998AbgFXNaK (ORCPT ); Wed, 24 Jun 2020 09:30:10 -0400 Received: from janet.servers.dxld.at (janet.servers.dxld.at [IPv6:2a01:4f8:201:89f4::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D2AE9C0613ED for ; Wed, 24 Jun 2020 06:30:09 -0700 (PDT) Received: janet.servers.dxld.at; Wed, 24 Jun 2020 15:30:07 +0200 From: =?utf-8?q?Daniel_Gr=C3=B6ber?= To: netfilter-devel@vger.kernel.org Subject: [libnf_ct PATCH v2 2/9] Fix nfexp_snprintf return value docs Date: Wed, 24 Jun 2020 15:29:58 +0200 Message-Id: <20200624133005.22046-2-dxld@darkboxed.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200624133005.22046-1-dxld@darkboxed.org> References: <20200624133005.22046-1-dxld@darkboxed.org> MIME-Version: 1.0 X-Spam-score: -0.0 X-Spam-bar: / Sender: netfilter-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netfilter-devel@vger.kernel.org The docs currently say "[...] Otherwise, 0 is returned." which is just completely wrong. Just like nfct_snprintf the expected buffer size is returned. Signed-off-by: Daniel Gröber --- src/expect/api.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/expect/api.c b/src/expect/api.c index 33099d8..39cd092 100644 --- a/src/expect/api.c +++ b/src/expect/api.c @@ -795,8 +795,9 @@ int nfexp_catch(struct nfct_handle *h) * - NFEXP_O_LAYER: include layer 3 information in the output, this is * *only* required by NFEXP_O_DEFAULT. * - * On error, -1 is returned and errno is set appropiately. Otherwise, - * 0 is returned. + * On error, -1 is returned and errno is set appropiately. Otherwise the + * size of what _would_ be written is returned, even if the size of the + * buffer is insufficient. This behaviour is similar to snprintf. */ int nfexp_snprintf(char *buf, unsigned int size,