Skip to contentSkip to conversation

setenv may set errno

DISCUSSION [email protected] 2 participants 2 messages Sep 8, 2009 – Sep 20, 2009 1 message not in the archive Man-pages: manual pages for Linux -- Sections 2, 3, 4, 5, and 7

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#2 lore raw

Hello Georg,

Quoted 4 lines · On Tue, Sep 8, 2009 at 11:12 AM, <gsauthof-If1cxaH3S3JVgF+RW+Bo1SZEdBbF94EN@pu…

Hi,

in setenv(3) in the section 'RETURN VALUE' it is not mentioned, that setenv() may set errno. For unsetenv() the section mentions this.

Thanks! Your comment actually triggered a few other changes as well. See the patc below, which will be in man-pages-3.22.

Cheers,

Michael

man3/setenv.3 +9 -3
@@ -82,8 +82,10 @@ then the function succeeds, and the environment is unchanged.
 .SH "RETURN VALUE"
 The
 .BR setenv ()
-function returns zero on success, or \-1 if there
-was insufficient space in the environment.
+function returns zero on success,
+or \-1 on error, with
+.I errno
+set to indicate the cause of the error.
 
 The
 .BR unsetenv ()
@@ -95,7 +97,11 @@ set to indicate the cause of the error.
 .TP
 .B EINVAL
 .I name
-contained an \(aq=\(aq character.
+is NULL, points to a string of length 0,
+or contains an \(aq=\(aq character.
+.TP
+.B ENOMEM
+Insufficient memory to add a new variable to the environment.
 .SH "CONFORMING TO"
 4.3BSD, POSIX.1-2001.
 .SH "NOTES"
Signature · 8 lines
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Watch my Linux system programming book progress to publication!
http://blog.man7.org/
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html