Deleted Added
full compact
fetch.c (243147) fetch.c (244037)
1/*-
2 * Copyright (c) 2000-2011 Dag-Erling Sm��rgrav
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

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

22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
29#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2000-2011 Dag-Erling Sm��rgrav
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

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

22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
29#include <sys/cdefs.h>
30__FBSDID("$FreeBSD: head/usr.bin/fetch/fetch.c 243147 2012-11-16 12:05:10Z andre $");
30__FBSDID("$FreeBSD: head/usr.bin/fetch/fetch.c 244037 2012-12-08 18:41:16Z eadler $");
31
32#include <sys/param.h>
33#include <sys/socket.h>
34#include <sys/stat.h>
35#include <sys/time.h>
36
37#include <ctype.h>
38#include <err.h>

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

613 if (sb.st_size != -1 && S_ISREG(sb.st_mode)) {
614 if ((slash = strrchr(path, '/')) == NULL)
615 slash = path;
616 else
617 ++slash;
618 asprintf(&tmppath, "%.*s.fetch.XXXXXX.%s",
619 (int)(slash - path), path, slash);
620 if (tmppath != NULL) {
31
32#include <sys/param.h>
33#include <sys/socket.h>
34#include <sys/stat.h>
35#include <sys/time.h>
36
37#include <ctype.h>
38#include <err.h>

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

613 if (sb.st_size != -1 && S_ISREG(sb.st_mode)) {
614 if ((slash = strrchr(path, '/')) == NULL)
615 slash = path;
616 else
617 ++slash;
618 asprintf(&tmppath, "%.*s.fetch.XXXXXX.%s",
619 (int)(slash - path), path, slash);
620 if (tmppath != NULL) {
621 mkstemps(tmppath, strlen(slash) + 1);
621 if (mkstemps(tmppath, strlen(slash) + 1) == -1) {
622 warn("%s: mkstemps()", path);
623 goto failure;
624 }
622 of = fopen(tmppath, "w");
623 chown(tmppath, sb.st_uid, sb.st_gid);
624 chmod(tmppath, sb.st_mode & ALLPERMS);
625 }
626 }
627 if (of == NULL)
628 of = fopen(path, "w");
629 if (of == NULL) {

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

983 pgrp = getpgrp();
984
985 r = 0;
986
987 /* authentication */
988 if (v_tty)
989 fetchAuthMethod = query_auth;
990 if (N_filename != NULL)
625 of = fopen(tmppath, "w");
626 chown(tmppath, sb.st_uid, sb.st_gid);
627 chmod(tmppath, sb.st_mode & ALLPERMS);
628 }
629 }
630 if (of == NULL)
631 of = fopen(path, "w");
632 if (of == NULL) {

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

986 pgrp = getpgrp();
987
988 r = 0;
989
990 /* authentication */
991 if (v_tty)
992 fetchAuthMethod = query_auth;
993 if (N_filename != NULL)
991 setenv("NETRC", N_filename, 1);
994 if (setenv("NETRC", N_filename, 1) == -1)
995 err(1, "setenv: cannot set NETRC=%s", N_filename);
992
993 while (argc) {
994 if ((p = strrchr(*argv, '/')) == NULL)
995 p = *argv;
996 else
997 p++;
998
999 if (!*p)

--- 47 unchanged lines hidden ---
996
997 while (argc) {
998 if ((p = strrchr(*argv, '/')) == NULL)
999 p = *argv;
1000 else
1001 p++;
1002
1003 if (!*p)

--- 47 unchanged lines hidden ---