Author: des
Date: Sun May 25 16:21:12 2014
New Revision: 266655
URL: http://svnweb.freebsd.org/changeset/base/266655

Log:
  MFH (r241737): staticize option variables
  MFH (r253804): credit Michael Gmelin for SSL code
  MFH (r251262): fix inode check for file change detection
  MFH (r261233): bump copyright dates
  MFH (r261234): increase minimum buffer size
  
  Approved by:  re (gjb)

Modified:
  stable/9/usr.bin/fetch/fetch.1
  stable/9/usr.bin/fetch/fetch.c
Directory Properties:
  stable/9/usr.bin/fetch/   (props changed)

Modified: stable/9/usr.bin/fetch/fetch.1
==============================================================================
--- stable/9/usr.bin/fetch/fetch.1      Sun May 25 16:20:53 2014        
(r266654)
+++ stable/9/usr.bin/fetch/fetch.1      Sun May 25 16:21:12 2014        
(r266655)
@@ -1,5 +1,6 @@
 .\"-
-.\" Copyright (c) 2000-2011 Dag-Erling Smørgrav
+.\" Copyright (c) 2000-2014 Dag-Erling Smørgrav
+.\" Copyright (c) 2013 Michael Gmelin <free...@grem.de>
 .\" All rights reserved.
 .\" Portions Copyright (c) 1999 Massachusetts Institute of Technology; used
 .\" by permission.
@@ -29,7 +30,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd July 30, 2013
+.Dd January 28, 2014
 .Dt FETCH 1
 .Os
 .Sh NAME
@@ -117,7 +118,7 @@ Automatically retry the transfer upon so
 Allow SSL version 2 when negotiating the connection.
 .It Fl B Ar bytes , Fl -buffer-size= Ns Ar bytes
 Specify the read buffer size in bytes.
-The default is 4096 bytes.
+The default is 16,384 bytes.
 Attempts to set a buffer size lower than this will be silently
 ignored.
 The number of reads actually performed is reported at verbosity level

Modified: stable/9/usr.bin/fetch/fetch.c
==============================================================================
--- stable/9/usr.bin/fetch/fetch.c      Sun May 25 16:20:53 2014        
(r266654)
+++ stable/9/usr.bin/fetch/fetch.c      Sun May 25 16:21:12 2014        
(r266655)
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2000-2011 Dag-Erling Smørgrav
+ * Copyright (c) 2000-2014 Dag-Erling Smørgrav
  * Copyright (c) 2013 Michael Gmelin <free...@grem.de>
  * All rights reserved.
  *
@@ -49,51 +49,51 @@ __FBSDID("$FreeBSD$");
 
 #include <fetch.h>
 
-#define MINBUFSIZE     4096
+#define MINBUFSIZE     16384
 #define TIMEOUT                120
 
 /* Option flags */
-int     A_flag;        /*    -A: do not follow 302 redirects */
-int     a_flag;        /*    -a: auto retry */
-off_t   B_size;        /*    -B: buffer size */
-int     b_flag;        /*!   -b: workaround TCP bug */
-char    *c_dirname;    /*    -c: remote directory */
-int     d_flag;        /*    -d: direct connection */
-int     F_flag;        /*    -F: restart without checking mtime  */
-char   *f_filename;    /*    -f: file to fetch */
-char   *h_hostname;    /*    -h: host to fetch from */
-int     i_flag;        /*    -i: specify input file for mtime comparison */
-char   *i_filename;    /*        name of input file */
-int     l_flag;        /*    -l: link rather than copy file: URLs */
-int     m_flag;        /* -[Mm]: mirror mode */
-char   *N_filename;    /*    -N: netrc file name */
-int     n_flag;        /*    -n: do not preserve modification time */
-int     o_flag;        /*    -o: specify output file */
-int     o_directory;   /*        output file is a directory */
-char   *o_filename;    /*        name of output file */
-int     o_stdout;      /*        output file is stdout */
-int     once_flag;     /*    -1: stop at first successful file */
-int     p_flag;        /* -[Pp]: use passive FTP */
-int     R_flag;        /*    -R: don't delete partially transferred files */
-int     r_flag;        /*    -r: restart previously interrupted transfer */
-off_t   S_size;        /*    -S: require size to match */
-int     s_flag;        /*    -s: show size, don't fetch */
-long    T_secs;        /*    -T: transfer timeout in seconds */
-int     t_flag;        /*!   -t: workaround TCP bug */
-int     U_flag;        /*    -U: do not use high ports */
-int     v_level = 1;   /*    -v: verbosity level */
-int     v_tty;         /*        stdout is a tty */
-pid_t   pgrp;          /*        our process group */
-long    w_secs;        /*    -w: retry delay */
-int     family = PF_UNSPEC;    /* -[46]: address family to use */
-
-int     sigalrm;       /* SIGALRM received */
-int     siginfo;       /* SIGINFO received */
-int     sigint;        /* SIGINT received */
-
-long    ftp_timeout = TIMEOUT;         /* default timeout for FTP transfers */
-long    http_timeout = TIMEOUT;        /* default timeout for HTTP transfers */
-char   *buf;           /* transfer buffer */
+static int      A_flag;        /*    -A: do not follow 302 redirects */
+static int      a_flag;        /*    -a: auto retry */
+static off_t    B_size;        /*    -B: buffer size */
+static int      b_flag;        /*!   -b: workaround TCP bug */
+static char    *c_dirname;     /*    -c: remote directory */
+static int      d_flag;        /*    -d: direct connection */
+static int      F_flag;        /*    -F: restart without checking mtime  */
+static char    *f_filename;    /*    -f: file to fetch */
+static char    *h_hostname;    /*    -h: host to fetch from */
+static int      i_flag;        /*    -i: specify file for mtime comparison */
+static char    *i_filename;    /*        name of input file */
+static int      l_flag;        /*    -l: link rather than copy file: URLs */
+static int      m_flag;        /* -[Mm]: mirror mode */
+static char    *N_filename;    /*    -N: netrc file name */
+static int      n_flag;        /*    -n: do not preserve modification time */
+static int      o_flag;        /*    -o: specify output file */
+static int      o_directory;   /*        output file is a directory */
+static char    *o_filename;    /*        name of output file */
+static int      o_stdout;      /*        output file is stdout */
+static int      once_flag;     /*    -1: stop at first successful file */
+static int      p_flag;        /* -[Pp]: use passive FTP */
+static int      R_flag;        /*    -R: don't delete partial files */
+static int      r_flag;        /*    -r: restart previous transfer */
+static off_t    S_size;        /*    -S: require size to match */
+static int      s_flag;        /*    -s: show size, don't fetch */
+static long     T_secs;        /*    -T: transfer timeout in seconds */
+static int      t_flag;        /*!   -t: workaround TCP bug */
+static int      U_flag;        /*    -U: do not use high ports */
+static int      v_level = 1;   /*    -v: verbosity level */
+static int      v_tty;         /*        stdout is a tty */
+static pid_t    pgrp;          /*        our process group */
+static long     w_secs;        /*    -w: retry delay */
+static int      family = PF_UNSPEC;    /* -[46]: address family to use */
+
+static int      sigalrm;       /* SIGALRM received */
+static int      siginfo;       /* SIGINFO received */
+static int      sigint;        /* SIGINT received */
+
+static long     ftp_timeout = TIMEOUT; /* default timeout for FTP transfers */
+static long     http_timeout = TIMEOUT;/* default timeout for HTTP transfers */
+static char    *buf;           /* transfer buffer */
 
 enum options
 {
@@ -109,7 +109,7 @@ enum options
        OPTION_SSL_CLIENT_KEY_FILE,
        OPTION_SSL_CRL_FILE,
        OPTION_SSL_NO_SSL3,
-       OPTION_SSL_NO_TLS1,     
+       OPTION_SSL_NO_TLS1,
        OPTION_SSL_NO_VERIFY_HOSTNAME,
        OPTION_SSL_NO_VERIFY_PEER
 };
@@ -147,7 +147,7 @@ static struct option longopts[] =
        { "passive-portrange-default", no_argument, NULL, 'T' },
        { "verbose", no_argument, NULL, 'v' },
        { "retry-delay", required_argument, NULL, 'w' },
-       
+
        /* options without a single character equivalent */
        { "bind-address", required_argument, NULL, OPTION_BIND_ADDRESS },
        { "no-passive", no_argument, NULL, OPTION_NO_FTP_PASSIVE_MODE },
@@ -639,7 +639,7 @@ fetch(char *URL, const char *path)
                                goto failure;
                        }
                        if (nsb.st_dev != sb.st_dev ||
-                           nsb.st_ino != nsb.st_ino ||
+                           nsb.st_ino != sb.st_ino ||
                            nsb.st_size != sb.st_size) {
                                warnx("%s: file has changed", URL);
                                fclose(of);
@@ -716,6 +716,7 @@ fetch(char *URL, const char *path)
        sigalrm = siginfo = sigint = 0;
 
        /* suck in the data */
+       setvbuf(f, NULL, _IOFBF, B_size);
        signal(SIGINFO, sig_handler);
        while (!sigint) {
                if (us.size != -1 && us.size - count < B_size &&
_______________________________________________
svn-src-stable-9@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9
To unsubscribe, send any mail to "svn-src-stable-9-unsubscr...@freebsd.org"

Reply via email to