Deleted Added
full compact
fdopen.c (55837) fdopen.c (56698)
1/*-
2 * Copyright (c) 1990, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * Chris Torek.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 19 unchanged lines hidden (view full) ---

28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 * SUCH DAMAGE.
35 *
1/*-
2 * Copyright (c) 1990, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * Chris Torek.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 19 unchanged lines hidden (view full) ---

28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 * SUCH DAMAGE.
35 *
36 * $FreeBSD: head/lib/libc/stdio/fdopen.c 55837 2000-01-12 09:23:48Z jasone $
36 * $FreeBSD: head/lib/libc/stdio/fdopen.c 56698 2000-01-27 23:07:25Z jasone $
37 */
38
39#if defined(LIBC_SCCS) && !defined(lint)
40static char sccsid[] = "@(#)fdopen.c 8.1 (Berkeley) 6/4/93";
41#endif /* LIBC_SCCS and not lint */
42
43#include <sys/types.h>
44#include <fcntl.h>

--- 13 unchanged lines hidden (view full) ---

58
59 if (nofile == 0)
60 nofile = getdtablesize();
61
62 if ((flags = __sflags(mode, &oflags)) == 0)
63 return (NULL);
64
65 /* Make sure the mode the user wants is a subset of the actual mode. */
37 */
38
39#if defined(LIBC_SCCS) && !defined(lint)
40static char sccsid[] = "@(#)fdopen.c 8.1 (Berkeley) 6/4/93";
41#endif /* LIBC_SCCS and not lint */
42
43#include <sys/types.h>
44#include <fcntl.h>

--- 13 unchanged lines hidden (view full) ---

58
59 if (nofile == 0)
60 nofile = getdtablesize();
61
62 if ((flags = __sflags(mode, &oflags)) == 0)
63 return (NULL);
64
65 /* Make sure the mode the user wants is a subset of the actual mode. */
66 if ((fdflags = _libc_fcntl(fd, F_GETFL, 0)) < 0)
66 if ((fdflags = _fcntl(fd, F_GETFL, 0)) < 0)
67 return (NULL);
68 tmp = fdflags & O_ACCMODE;
69 if (tmp != O_RDWR && (tmp != (oflags & O_ACCMODE))) {
70 errno = EINVAL;
71 return (NULL);
72 }
73
74 if ((fp = __sfp()) == NULL)

--- 17 unchanged lines hidden ---
67 return (NULL);
68 tmp = fdflags & O_ACCMODE;
69 if (tmp != O_RDWR && (tmp != (oflags & O_ACCMODE))) {
70 errno = EINVAL;
71 return (NULL);
72 }
73
74 if ((fp = __sfp()) == NULL)

--- 17 unchanged lines hidden ---