From owner-svn-src-head@freebsd.org Tue May 5 17:57:05 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9916513EF86; Tue, 5 May 2020 17:57:05 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49GnVT3bMDz4K3k; Tue, 5 May 2020 17:57:05 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 76A0B19E2C; Tue, 5 May 2020 17:57:05 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 045Hv5rR077536; Tue, 5 May 2020 17:57:05 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 045Hv5I6077534; Tue, 5 May 2020 17:57:05 GMT (envelope-from cem@FreeBSD.org) Message-Id: <202005051757.045Hv5I6077534@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Tue, 5 May 2020 17:57:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r360664 - head/lib/libc/string X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head/lib/libc/string X-SVN-Commit-Revision: 360664 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 May 2020 17:57:05 -0000 Author: cem Date: Tue May 5 17:57:04 2020 New Revision: 360664 URL: https://svnweb.freebsd.org/changeset/base/360664 Log: strdup.3: Slightly canonicalize OOM return/error status Attempted to clean up the language around "this is a malloc'd object." May be passed as a parameter to free(3) is a bit obtuse. Sponsored by: Dell EMC Isilon Modified: head/lib/libc/string/strdup.3 Modified: head/lib/libc/string/strdup.3 ============================================================================== --- head/lib/libc/string/strdup.3 Tue May 5 17:55:45 2020 (r360663) +++ head/lib/libc/string/strdup.3 Tue May 5 17:57:04 2020 (r360664) @@ -28,7 +28,7 @@ .\" @(#)strdup.3 8.1 (Berkeley) 6/9/93 .\" $FreeBSD$ .\" -.Dd June 6, 2018 +.Dd May 5, 2020 .Dt STRDUP 3 .Os .Sh NAME @@ -51,15 +51,12 @@ allocates sufficient memory for a copy of the string .Fa str , does the copy, and returns a pointer to it. -The pointer may subsequently be used as an -argument to the function -.Xr free 3 . +The memory is allocated with +.Xr malloc 3 +and should be released with +.Xr free 3 +when no longer needed. .Pp -If insufficient memory is available, NULL is returned and -.Va errno -is set to -.Er ENOMEM . -.Pp The .Fn strndup function copies at most @@ -69,6 +66,14 @@ characters from the string always .Dv NUL terminating the copied string. +.Sh RETURN VALUES +If insufficient memory is available, NULL is returned and +.Va errno +is set to +.Er ENOMEM . +Otherwise, the +.Fn strdup +family of functions return a pointer to the copied string. .Sh SEE ALSO .Xr free 3 , .Xr malloc 3 ,