fopen.c (71579) | fopen.c (72373) |
---|---|
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/fopen.c 71579 2001-01-24 13:01:12Z deischen $ | 36 * $FreeBSD: head/lib/libc/stdio/fopen.c 72373 2001-02-11 22:06:43Z deischen $ |
37 */ 38 39#if defined(LIBC_SCCS) && !defined(lint) 40static char sccsid[] = "@(#)fopen.c 8.1 (Berkeley) 6/4/93"; 41#endif /* LIBC_SCCS and not lint */ 42 43#include "namespace.h" 44#include <sys/types.h> --- 24 unchanged lines hidden (view full) --- 69 } 70 fp->_file = f; 71 fp->_flags = flags; 72 fp->_cookie = fp; 73 fp->_read = __sread; 74 fp->_write = __swrite; 75 fp->_seek = __sseek; 76 fp->_close = __sclose; | 37 */ 38 39#if defined(LIBC_SCCS) && !defined(lint) 40static char sccsid[] = "@(#)fopen.c 8.1 (Berkeley) 6/4/93"; 41#endif /* LIBC_SCCS and not lint */ 42 43#include "namespace.h" 44#include <sys/types.h> --- 24 unchanged lines hidden (view full) --- 69 } 70 fp->_file = f; 71 fp->_flags = flags; 72 fp->_cookie = fp; 73 fp->_read = __sread; 74 fp->_write = __swrite; 75 fp->_seek = __sseek; 76 fp->_close = __sclose; |
77 /* fp->_lock = NULL; */ | |
78 /* 79 * When opening in append mode, even though we use O_APPEND, 80 * we need to seek to the end so that ftell() gets the right 81 * answer. If the user then alters the seek pointer, or 82 * the file extends, this will fail, but there is not much 83 * we can do about this. (We could set __SAPP and check in 84 * fseek and ftell.) 85 */ 86 if (oflags & O_APPEND) 87 (void) __sseek((void *)fp, (fpos_t)0, SEEK_END); 88 return (fp); 89} | 77 /* 78 * When opening in append mode, even though we use O_APPEND, 79 * we need to seek to the end so that ftell() gets the right 80 * answer. If the user then alters the seek pointer, or 81 * the file extends, this will fail, but there is not much 82 * we can do about this. (We could set __SAPP and check in 83 * fseek and ftell.) 84 */ 85 if (oflags & O_APPEND) 86 (void) __sseek((void *)fp, (fpos_t)0, SEEK_END); 87 return (fp); 88} |