From owner-freebsd-bugs Wed Sep 18 20:20:13 1996 Return-Path: owner-bugs Received: (from root@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id UAA27347 for bugs-outgoing; Wed, 18 Sep 1996 20:20:13 -0700 (PDT) Received: (from gnats@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id UAA27299; Wed, 18 Sep 1996 20:20:08 -0700 (PDT) Resent-Date: Wed, 18 Sep 1996 20:20:08 -0700 (PDT) Resent-Message-Id: <199609190320.UAA27299@freefall.freebsd.org> Resent-From: gnats (GNATS Management) Resent-To: freebsd-bugs Resent-Reply-To: FreeBSD-gnats@freefall.FreeBSD.org, thorpej@nas.nasa.gov Received: from nostromo.nas.nasa.gov (nostromo.nas.nasa.gov [129.99.223.15]) by freefall.freebsd.org (8.7.5/8.7.3) with ESMTP id UAA26241 for ; Wed, 18 Sep 1996 20:16:20 -0700 (PDT) Received: (from thorpej@localhost) by nostromo.nas.nasa.gov (8.7.5/8.6.9-rAT) id UAA07715; Wed, 18 Sep 1996 20:10:12 -0700 (PDT) Message-Id: <199609190310.UAA07715@nostromo.nas.nasa.gov> Date: Wed, 18 Sep 1996 20:10:12 -0700 (PDT) From: Jason Thorpe Reply-To: thorpej@nas.nasa.gov To: FreeBSD-gnats-submit@freebsd.org X-Send-Pr-Version: 3.95 Subject: bin/1641: fetch(1) is not 64-bit safe Sender: owner-bugs@freebsd.org X-Loop: FreeBSD.org Precedence: bulk >Number: 1641 >Category: bin >Synopsis: fetch(1) is not 64-bit safe >Confidential: no >Severity: serious >Priority: low >Responsible: freebsd-bugs >State: open >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Wed Sep 18 20:20:04 PDT 1996 >Last-Modified: >Originator: Jason Thorpe >Organization: Numerical Aerodynamic Simulation Project - NASA Ames >Release: FreeBSD-current 960918, build on NetBSD/alpha >Environment: System: NetBSD nostromo 1.2A NetBSD 1.2A (NOSY) #14: Wed Sep 18 14:54:10 PDT 1996 thorpej@nostromo:/work/clean-current/src/sys/arch/alpha/compile/NOSY alpha >Description: fetch(1) is not 64-bit safe. >How-To-Repeat: Try to build fetch(1) under NetBSD/alpha. Lose. >Fix: Below are diffs which make fetch(1) 64-bit safe (inasmuch as it compiles without warnings, and seems to work properly under NetBSD/alpha). Also, did some minor cleaning up of some stuff, but I didn't get too bonkers. Note that these diffs assume the previously submitted changes to libftpio, notably the "file offsets are off_ts" changes. ----- snip ----- Index: main.c =================================================================== RCS file: /mastersrc/netbsd/src/usr.bin/fetch/main.c,v retrieving revision 1.1.1.2 retrieving revision 1.4 diff -c -r1.1.1.2 -r1.4 *** main.c 1996/09/19 02:37:53 1.1.1.2 --- main.c 1996/09/19 03:01:46 1.4 *************** *** 1,3 **** --- 1,5 ---- + /* $NetBSD: $ */ + /*- * Copyright (c) 1996 * Jean-Marc Zucconi *************** *** 24,48 **** * SUCH DAMAGE. */ ! /* $Id: main.c,v 1.1.1.2 1996/09/19 02:37:53 thorpej Exp $ */ #include #include #include #include #include ! #include ! #include #include #include #include ! #include #include #include - #include - #include - #include #include #include --- 26,58 ---- * SUCH DAMAGE. */ ! /* FreeBSD Id: main.c,v 1.21 1996/09/10 19:49:41 jkh Exp */ + #include + #include + #include + #include #include #include #include #include #include ! #include + #include + + #include + #include #include ! #include #include #include #include + #include + #include + #include + #include #include *************** *** 52,58 **** char buffer[BUFFER_SIZE]; ! char *progname; int verbose = 1; int ftp_verbose = 0; --- 62,68 ---- char buffer[BUFFER_SIZE]; ! extern char *__progname; /* from crt0.o */ int verbose = 1; int ftp_verbose = 0; *************** *** 76,82 **** void usage(void), die(int), rm(void), timeout(int), ftpget(void), httpget(void), fileget(void), display(int, int), parse(char *), output_file_name(void), ! f_size(char *, int *, time_t *), ftperr(FILE* ftp, char *, ...), filter(unsigned char *, int), setup_http_proxy(void); --- 86,92 ---- void usage(void), die(int), rm(void), timeout(int), ftpget(void), httpget(void), fileget(void), display(int, int), parse(char *), output_file_name(void), ! f_size(char *, off_t *, time_t *), ftperr(FILE* ftp, char *, ...), filter(unsigned char *, int), setup_http_proxy(void); *************** *** 85,91 **** void usage() { ! fprintf(stderr, "usage: %s [-DHINPMTVLqlmnprv] [-o outputfile] <-f file -h host [-c dir]| URL>\n", progname); exit(1); } --- 95,101 ---- void usage() { ! fprintf(stderr, "usage: %s [-DHINPMTVLqlmnprv] [-o outputfile] <-f file -h host [-c dir]| URL>\n", __progname); exit(1); } *************** *** 96,104 **** rm(); if (!sig) ! fprintf (stderr, "%s: %s\n", progname, sys_errlist[e]); else ! fprintf (stderr, "%s: Interrupted by signal %d\n", progname, sig); exit(1); } --- 106,114 ---- rm(); if (!sig) ! fprintf (stderr, "%s: %s\n", __progname, strerror(e)); else ! warnx ("Interrupted by signal %d", sig); exit(1); } *************** *** 132,142 **** main(int argc, char **argv) { int c; ! char *s = strrchr (argv[0], '/'); ! ! progname = s ? s+1 : argv[0]; ! ! while ((c = getopt (argc, argv, "D:HINPMT:V:Lqc:f:h:o:plmnrv")) != EOF) { switch (c) { case 'D': case 'H': case 'I': case 'N': case 'L': case 'V': break; /* ncftp compatibility */ --- 142,149 ---- main(int argc, char **argv) { int c; ! ! while ((c = getopt (argc, argv, "D:HINPMT:V:Lqc:f:h:o:plmnrv")) != -1) { switch (c) { case 'D': case 'H': case 'I': case 'N': case 'L': case 'V': break; /* ncftp compatibility */ *************** *** 228,234 **** void timeout(int sig) { ! fprintf(stderr, "\n%s: Timeout\n", progname); rm(); exit(1); } --- 235,241 ---- void timeout(int sig) { ! fprintf (stderr, "\n%s: Timeout\n", __progname); rm(); exit(1); } *************** *** 276,282 **** FILE *ftp, *fp; char *cp, *lp; int status, n; ! ssize_t size, size0, seekloc; char ftp_pw[200]; time_t t; struct itimerval timer; --- 283,289 ---- FILE *ftp, *fp; char *cp, *lp; int status, n; ! off_t size, size0, seekloc; char ftp_pw[200]; time_t t; struct itimerval timer; *************** *** 454,460 **** s += 6; p = strchr(s, '/'); if (!p) { ! fprintf(stderr, "%s: no filename??\n", progname); usage(); } ftp = 1; --- 461,467 ---- s += 6; p = strchr(s, '/'); if (!p) { ! warnx("no filename??"); usage(); } ftp = 1; *************** *** 465,471 **** s += 7; p = strchr(s, '/'); if (!p) { ! fprintf (stderr, "%s: no filename??\n", progname); usage (); } *p++ = 0; --- 472,478 ---- s += 7; p = strchr(s, '/'); if (!p) { ! warnx ("no filename??"); usage (); } *p++ = 0; *************** *** 483,489 **** /* assume /host.name:/file/name */ p = strchr (s, ':'); if (!p) { ! fprintf (stderr, "%s: no filename??\n", progname); usage (); } } --- 490,496 ---- /* assume /host.name:/file/name */ p = strchr (s, ':'); if (!p) { ! warnx ("no filename??"); usage (); } } *************** *** 516,522 **** } void ! f_size (char *name, int *size, time_t *time) { struct stat s; --- 523,529 ---- } void ! f_size (char *name, off_t *size, time_t *time) { struct stat s; *************** *** 584,590 **** i = select (s+1, &fdset, 0, 0, &tout); switch (i) { case 0: ! fprintf (stderr, "%s: Timeout\n", progname); rm (); exit (1); case 1: --- 591,597 ---- i = select (s+1, &fdset, 0, 0, &tout); switch (i) { case 0: ! warnx ("Timeout"); rm (); exit (1); case 1: *************** *** 711,717 **** } sin.sin_port = htons (http_port); if ((s = socket (sin.sin_family, SOCK_STREAM, 0)) < 0) ! err (1, 0); bzero ((char *)&sin2, sizeof (sin2)); sin2.sin_family = AF_INET; sin2.sin_port = 0; --- 718,724 ---- } sin.sin_port = htons (http_port); if ((s = socket (sin.sin_family, SOCK_STREAM, 0)) < 0) ! err (1, "socket"); bzero ((char *)&sin2, sizeof (sin2)); sin2.sin_family = AF_INET; sin2.sin_port = 0; *************** *** 720,726 **** err (1, "could not bind to socket."); if (connect(s, (struct sockaddr *)&sin, sizeof(sin)) < 0) ! err (1, "connection failed."); return s; } --- 727,733 ---- err (1, "could not bind to socket."); if (connect(s, (struct sockaddr *)&sin, sizeof(sin)) < 0) ! err (1, "connection failed"); return s; } >Audit-Trail: >Unformatted: