Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 24 Dec 2003 05:54:16 -0800 (PST)
From:      Russell Francis <rf358197@ohio.edu>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   docs/60544: getenv(3) manpage doesn't state the return value from getenv()
Message-ID:  <200312241354.hBODsGEJ077775@www.freebsd.org>
Resent-Message-ID: <200312241400.hBOE0WrA040578@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>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@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:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200312241354.hBODsGEJ077775>