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
This commit is contained in:
Conrad Meyer 2020-05-05 17:57:04 +00:00
parent 6b1e5fae2c
commit b34f8412c5

View File

@ -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,14 +51,11 @@ 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 .
.Pp
If insufficient memory is available, NULL is returned and
.Va errno
is set to
.Er ENOMEM .
The memory is allocated with
.Xr malloc 3
and should be released with
.Xr free 3
when no longer needed.
.Pp
The
.Fn strndup
@ -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 ,