Deleted Added
full compact
stdio.c (249810) stdio.c (289863)
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

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

29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 * SUCH DAMAGE.
31 */
32
33#if defined(LIBC_SCCS) && !defined(lint)
34static char sccsid[] = "@(#)stdio.c 8.1 (Berkeley) 6/4/93";
35#endif /* LIBC_SCCS and not lint */
36#include <sys/cdefs.h>
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

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

29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 * SUCH DAMAGE.
31 */
32
33#if defined(LIBC_SCCS) && !defined(lint)
34static char sccsid[] = "@(#)stdio.c 8.1 (Berkeley) 6/4/93";
35#endif /* LIBC_SCCS and not lint */
36#include <sys/cdefs.h>
37__FBSDID("$FreeBSD: head/lib/libc/stdio/stdio.c 249810 2013-04-23 14:36:44Z emaste $");
37__FBSDID("$FreeBSD: head/lib/libc/stdio/stdio.c 289863 2015-10-24 02:23:15Z ache $");
38
39#include "namespace.h"
40#include <errno.h>
41#include <fcntl.h>
42#include <limits.h>
43#include <stdio.h>
44#include <stdlib.h>
45#include <unistd.h>

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

112 if (_sseek(fp, (fpos_t)0, SEEK_END) == -1 &&
113 (fp->_flags & __SOPT))
114 return (-1);
115 errno = serrno;
116 }
117 ret = (*fp->_write)(fp->_cookie, buf, n);
118 /* __SOFF removed even on success in case O_APPEND mode is set. */
119 if (ret >= 0) {
38
39#include "namespace.h"
40#include <errno.h>
41#include <fcntl.h>
42#include <limits.h>
43#include <stdio.h>
44#include <stdlib.h>
45#include <unistd.h>

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

112 if (_sseek(fp, (fpos_t)0, SEEK_END) == -1 &&
113 (fp->_flags & __SOPT))
114 return (-1);
115 errno = serrno;
116 }
117 ret = (*fp->_write)(fp->_cookie, buf, n);
118 /* __SOFF removed even on success in case O_APPEND mode is set. */
119 if (ret >= 0) {
120 if ((fp->_flags & (__SAPP|__SOFF)) == (__SAPP|__SOFF) &&
120 /* XXX: Reuse __SALC for O_APPEND. */
121 if ((fp->_flags & __SOFF) && !(fp->_flags & __SALC) &&
121 fp->_offset <= OFF_MAX - ret)
122 fp->_offset += ret;
123 else
124 fp->_flags &= ~__SOFF;
125
126 } else if (ret < 0)
127 fp->_flags &= ~__SOFF;
128 return (ret);

--- 40 unchanged lines hidden ---
122 fp->_offset <= OFF_MAX - ret)
123 fp->_offset += ret;
124 else
125 fp->_flags &= ~__SOFF;
126
127 } else if (ret < 0)
128 fp->_flags &= ~__SOFF;
129 return (ret);

--- 40 unchanged lines hidden ---