link.c (5e3934b15a2741b2de6b217e77dc9d798d740804) link.c (d350e8d795d53dbc58ea428f76355cf5e28f6116)
1/*-
2 * SPDX-License-Identifier: BSD-2-Clause
3 *
4 * Copyright (c) 2005 Brian Somers <brian@FreeBSD.org>
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

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

22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE.
27 */
28
29#include <sys/types.h>
1/*-
2 * SPDX-License-Identifier: BSD-2-Clause
3 *
4 * Copyright (c) 2005 Brian Somers <brian@FreeBSD.org>
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

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

22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE.
27 */
28
29#include <sys/types.h>
30
30#include <err.h>
31#include <limits.h>
32#include <stdbool.h>
33#include <stdio.h>
34#include <stdlib.h>
35#include <unistd.h>
36
37#include "extern.h"
38
39void
40c_link(const char *file1, off_t skip1, const char *file2, off_t skip2,
41 off_t limit)
42{
43 char buf1[PATH_MAX], *p1;
44 char buf2[PATH_MAX], *p2;
31#include <err.h>
32#include <limits.h>
33#include <stdbool.h>
34#include <stdio.h>
35#include <stdlib.h>
36#include <unistd.h>
37
38#include "extern.h"
39
40void
41c_link(const char *file1, off_t skip1, const char *file2, off_t skip2,
42 off_t limit)
43{
44 char buf1[PATH_MAX], *p1;
45 char buf2[PATH_MAX], *p2;
45 int dfound, len1, len2;
46 ssize_t len1, len2;
47 int dfound;
46 off_t byte;
47 u_char ch;
48
49 if ((len1 = readlink(file1, buf1, sizeof(buf1) - 1)) < 0) {
50 if (!sflag)
51 err(ERR_EXIT, "%s", file1);
52 else
53 exit(ERR_EXIT);

--- 46 unchanged lines hidden ---
48 off_t byte;
49 u_char ch;
50
51 if ((len1 = readlink(file1, buf1, sizeof(buf1) - 1)) < 0) {
52 if (!sflag)
53 err(ERR_EXIT, "%s", file1);
54 else
55 exit(ERR_EXIT);

--- 46 unchanged lines hidden ---