From nobody@FreeBSD.org  Wed Dec 24 05:54:21 2003
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 9F20316A4CE
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 24 Dec 2003 05:54:21 -0800 (PST)
Received: from www.freebsd.org (www.freebsd.org [216.136.204.117])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 0DADE43D41
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 24 Dec 2003 05:54:17 -0800 (PST)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.12.10/8.12.10) with ESMTP id hBODsGdL077776
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 24 Dec 2003 05:54:16 -0800 (PST)
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.12.10/8.12.10/Submit) id hBODsGEJ077775;
	Wed, 24 Dec 2003 05:54:16 -0800 (PST)
	(envelope-from nobody)
Message-Id: <200312241354.hBODsGEJ077775@www.freebsd.org>
Date: Wed, 24 Dec 2003 05:54:16 -0800 (PST)
From: Russell Francis <rf358197@ohio.edu>
To: freebsd-gnats-submit@FreeBSD.org
Subject: getenv(3) manpage doesn't state the return value from getenv()
X-Send-Pr-Version: www-2.0

>Number:         60544
>Category:       docs
>Synopsis:       [patch] getenv(3) manpage doesn't state the return value from getenv()
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    trhodes
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          doc-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Dec 24 06:00:32 PST 2003
>Closed-Date:    Fri Nov 03 08:41:46 GMT 2006
>Last-Modified:  Fri Nov 03 08:41:46 GMT 2006
>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:
State-Changed-From-To: open->patched 
State-Changed-By: trhodes 
State-Changed-When: Thu Oct 12 08:40:01 UTC 2006 
State-Changed-Why:  
Revision 1.15 discussed the return value, so I have committed 
a different fix explaining that applications should not modify 
the return value.  Thanks for the submission! 


Responsible-Changed-From-To: freebsd-doc->trhodes 
Responsible-Changed-By: trhodes 
Responsible-Changed-When: Thu Oct 12 08:40:01 UTC 2006 
Responsible-Changed-Why:  
Over to me, MFC reminder. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=60544 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: docs/60544: commit references a PR
Date: Thu, 12 Oct 2006 08:39:49 +0000 (UTC)

 trhodes     2006-10-12 08:39:24 UTC
 
   FreeBSD src repository
 
   Modified files:
     lib/libc/stdlib      getenv.3 
   Log:
   Note that the value from getenv() should not be modified by applications.
   
   PR:             60544
   Reviewed by:    ru
   
   Revision  Changes    Path
   1.19      +5 -1      src/lib/libc/stdlib/getenv.3
 _______________________________________________
 cvs-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/cvs-all
 To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
 
State-Changed-From-To: patched->closed 
State-Changed-By: trhodes 
State-Changed-When: Fri Nov 3 08:41:21 UTC 2006 
State-Changed-Why:  
Changes have been merged to RELENG_6, thanks! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=60544 
>Unformatted:
