Fixed F_SETFL to properly convert between internal

libio flags and external fcntl.h style flags.
This commit is contained in:
Joel Sherrill
1999-11-02 16:27:53 +00:00
parent 063e4950f4
commit 5f2566b5e2
3 changed files with 9 additions and 6 deletions

View File

@@ -30,6 +30,7 @@ int fcntl(
rtems_libio_t *diop; rtems_libio_t *diop;
int fd2; int fd2;
int flags; int flags;
int mask;
int ret = 0; int ret = 0;
va_start( ap, cmd ); va_start( ap, cmd );
@@ -92,13 +93,13 @@ int fcntl(
case F_SETFL: case F_SETFL:
flags = rtems_libio_fcntl_flags( va_arg( ap, int ) ); flags = rtems_libio_fcntl_flags( va_arg( ap, int ) );
mask = LIBIO_FLAGS_NO_DELAY | LIBIO_FLAGS_APPEND;
/* /*
* XXX If we are turning on append, should we seek to the end? * XXX If we are turning on append, should we seek to the end?
*/ */
iop->flags = (iop->flags & ~(O_APPEND | O_NONBLOCK)) | iop->flags = (iop->flags & ~mask) | (flags & mask);
(flags & (O_APPEND | O_NONBLOCK));
break; break;
case F_GETLK: case F_GETLK:

View File

@@ -30,6 +30,7 @@ int fcntl(
rtems_libio_t *diop; rtems_libio_t *diop;
int fd2; int fd2;
int flags; int flags;
int mask;
int ret = 0; int ret = 0;
va_start( ap, cmd ); va_start( ap, cmd );
@@ -92,13 +93,13 @@ int fcntl(
case F_SETFL: case F_SETFL:
flags = rtems_libio_fcntl_flags( va_arg( ap, int ) ); flags = rtems_libio_fcntl_flags( va_arg( ap, int ) );
mask = LIBIO_FLAGS_NO_DELAY | LIBIO_FLAGS_APPEND;
/* /*
* XXX If we are turning on append, should we seek to the end? * XXX If we are turning on append, should we seek to the end?
*/ */
iop->flags = (iop->flags & ~(O_APPEND | O_NONBLOCK)) | iop->flags = (iop->flags & ~mask) | (flags & mask);
(flags & (O_APPEND | O_NONBLOCK));
break; break;
case F_GETLK: case F_GETLK:

View File

@@ -30,6 +30,7 @@ int fcntl(
rtems_libio_t *diop; rtems_libio_t *diop;
int fd2; int fd2;
int flags; int flags;
int mask;
int ret = 0; int ret = 0;
va_start( ap, cmd ); va_start( ap, cmd );
@@ -92,13 +93,13 @@ int fcntl(
case F_SETFL: case F_SETFL:
flags = rtems_libio_fcntl_flags( va_arg( ap, int ) ); flags = rtems_libio_fcntl_flags( va_arg( ap, int ) );
mask = LIBIO_FLAGS_NO_DELAY | LIBIO_FLAGS_APPEND;
/* /*
* XXX If we are turning on append, should we seek to the end? * XXX If we are turning on append, should we seek to the end?
*/ */
iop->flags = (iop->flags & ~(O_APPEND | O_NONBLOCK)) | iop->flags = (iop->flags & ~mask) | (flags & mask);
(flags & (O_APPEND | O_NONBLOCK));
break; break;
case F_GETLK: case F_GETLK: