docs/60544: getenv(3) manpage doesn't state the return value from getenv()

Russell Francis rf358197 at ohio.edu
Wed Dec 24 14:00:36 UTC 2003


>Number:         60544
>Category:       docs
>Synopsis:       getenv(3) manpage doesn't state the return value from getenv()
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-doc
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          doc-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Dec 24 06:00:32 PST 2003
>Closed-Date:
>Last-Modified:
>Originator:     Russell Francis
>Release:        FreeBSD 5.1-RELEASE
>Organization:
>Environment:
FreeBSD zoidberg 5.1-RELEASE-p10 FreeBSD 5.1-RELEASE-p10 #0: Thu Oct  9 22:24:10 EDT 2003     root at localhost:/usr/obj/usr/src/sys/FREAKER  i386    
>Description:
The getenv(3) manpage doesn't state that the return value should not be freed.  This has the potential of creating confusion for developers who may be tempted to free the value returned from getenv.

Attached is a short diff which clarifies description of the return value from getenv in the manpage.
>How-To-Repeat:
Type this

#man 3 getenv
>Fix:
--- getenv.3	Mon Oct 13 10:15:27 2003
+++ getenv.3.new	Mon Oct 13 10:15:03 2003
@@ -116,6 +116,13 @@
 from the list.
 .Sh RETURN VALUES
 .Rv -std setenv putenv
+.Pp
+The
+.Fn getenv
+function returns NULL if the environment variable was not found.
+If the variable was found, it returns the value of the variable
+as a NULL terminated string.  This string should not be modified
+or freed.
 .Sh ERRORS
 .Bl -tag -width Er
 .It Bq Er ENOMEM
>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the freebsd-doc mailing list