- In pipe() return the error returned by pipe_create(), rather then
    hardcoded ENFILES, which is incorrect. pipe_create() can fail due
    to ENOMEM.
  - Update manual page, describing ENOMEM return code.

  Reviewed by:    arch
This commit is contained in:
glebius 2006-01-31 15:44:51 +00:00
parent 8b1551dbbf
commit fbdc4a3cd4
2 changed files with 6 additions and 3 deletions

View File

@ -32,7 +32,7 @@
.\" @(#)pipe.2 8.1 (Berkeley) 6/4/93
.\" $FreeBSD$
.\"
.Dd June 4, 1993
.Dd January 30, 2006
.Dt PIPE 2
.Os
.Sh NAME
@ -98,6 +98,8 @@ system call will fail if:
Too many descriptors are active.
.It Bq Er ENFILE
The system file table is full.
.It Bq Er ENOMEM
Not enough kernel memory to establish a pipe.
.It Bq Er EFAULT
The
.Fa fildes

View File

@ -357,10 +357,11 @@ pipe(td, uap)
NULL);
/* Only the forward direction pipe is backed by default */
if (pipe_create(rpipe, 1) || pipe_create(wpipe, 0)) {
if ((error = pipe_create(rpipe, 1)) != 0 ||
(error = pipe_create(wpipe, 0)) != 0) {
pipeclose(rpipe);
pipeclose(wpipe);
return (ENFILE);
return (error);
}
rpipe->pipe_state |= PIPE_DIRECTOK;