Browse Source

Use autoconf to enable largefile support where necessary. Use ftello where available, since ftell can fail at 2GB.

svn:r2806
Nick Mathewson 20 years ago
parent
commit
5d92fbe30e
3 changed files with 11 additions and 8 deletions
  1. 3 1
      configure.in
  2. 4 0
      src/common/log.c
  3. 4 7
      src/or/circuitbuild.c

+ 3 - 1
configure.in

@@ -135,6 +135,8 @@ if (test ! -z "$ac_cv_openssldir" && test "x$ac_cv_openssldir" != "x(system)") ;
 fi
 LIBS="$saved_LIBS"
 
+AC_SYS_LARGEFILE
+
 dnl The warning message here is no longer strictly accurate.
 
 AC_CHECK_HEADERS(unistd.h string.h signal.h netdb.h ctype.h poll.h sys/stat.h sys/poll.h sys/types.h fcntl.h sys/fcntl.h sys/ioctl.h sys/socket.h sys/time.h netinet/in.h arpa/inet.h errno.h assert.h time.h pwd.h grp.h zlib.h, , AC_MSG_WARN(some headers were not found, compilation may fail))
@@ -143,7 +145,7 @@ dnl These headers are not essential
 
 AC_CHECK_HEADERS(stdint.h sys/types.h inttypes.h sys/param.h sys/wait.h sys/limits.h netinet/in.h arpa/inet.h machine/limits.h syslog.h sys/time.h sys/resource.h)
 
-AC_CHECK_FUNCS(gettimeofday ftime socketpair uname inet_aton strptime getrlimit setrlimit strlcat strlcpy strtoull getpwnam)
+AC_CHECK_FUNCS(gettimeofday ftime socketpair uname inet_aton strptime getrlimit setrlimit strlcat strlcpy strtoull getpwnam fseeko ftello)
 
 AC_CHECK_MEMBERS([struct timeval.tv_sec])
 

+ 4 - 0
src/common/log.c

@@ -89,7 +89,11 @@ static void log_tor_version(logfile_t *lf, int reset)
   if (lf->is_temporary)
     /* If it's temporary, it isn't really a file. */
     return;
+#if HAVE_FTELLO
+  is_new = (ftello(lf->file) == 0);
+#else
   is_new = (ftell(lf->file) == 0);
+#endif
   if (reset && !is_new)
     /* We are resetting, but we aren't at the start of the file; no
      * need to log again. */

+ 4 - 7
src/or/circuitbuild.c

@@ -20,12 +20,10 @@ extern circuit_t *global_circuitlist;
 
 static int
 circuit_deliver_create_cell(circuit_t *circ, char *payload);
-static cpath_build_state_t *
-onion_new_cpath_build_state(uint8_t purpose, const char *exit_digest);
-static int
-onion_extend_cpath(crypt_path_t **head_ptr, cpath_build_state_t
-                   *state, routerinfo_t **router_out);
-static int decide_circ_id_type(char *local_nick, char *remote_nick);
+static cpath_build_state_t *onion_new_cpath_build_state(uint8_t purpose,
+                                                   const char *exit_digest);
+static int onion_extend_cpath(crypt_path_t **head_ptr,
+                       cpath_build_state_t *state, routerinfo_t **router_out);
 static int count_acceptable_routers(smartlist_t *routers);
 
 /** Iterate over values of circ_id, starting from conn-\>next_circ_id,
@@ -342,7 +340,6 @@ void circuit_n_conn_done(connection_t *or_conn, int success) {
 
 static int
 circuit_deliver_create_cell(circuit_t *circ, char *payload) {
-  int circ_id_type;
   cell_t cell;
 
   tor_assert(circ);