* Copyright (c) 1990 The Regents of the University of California.
* This code is derived from software contributed to Berkeley by
* %sccs.include.redist.c%
#if defined(LIBC_SCCS) && !defined(lint)
static char sccsid
[] = "@(#)fopen.c 5.5 (Berkeley) %G%";
#endif /* LIBC_SCCS and not lint */
if ((flags
= __sflags(mode
, &oflags
)) == 0)
if ((fp
= __sfp()) == NULL
)
if ((f
= open(file
, oflags
, DEFFILEMODE
)) < 0) {
fp
->_flags
= 0; /* release */
* When opening in append mode, even though we use O_APPEND,
* we need to seek to the end so that ftell() gets the right
* answer. If the user then alters the seek pointer, or
* the file extends, this will fail, but there is not much
* we can do about this. (We could set __SAPP and check in
(void) __sseek((void *)fp
, (fpos_t)0, SEEK_END
);