diff options
-rw-r--r-- | CHANGES | 4 | ||||
-rw-r--r-- | configure.ac | 8 | ||||
-rw-r--r-- | lib/file.c | 2 | ||||
-rw-r--r-- | lib/multi.c | 2 | ||||
-rw-r--r-- | src/main.c | 9 |
5 files changed, 15 insertions, 10 deletions
@@ -10,8 +10,8 @@ Daniel Fandrich (9 Sep 2008) - Mike Revi discovered some swapped speed switches documented in the curl man page. -- Checked in some grammatical and minor other fixes in the documentation and - examples that I found in the FreeBSD ports system. +- Checked in some documentation and code improvements and fixes that I + discovered in the FreeBSD ports system. Daniel Stenberg (8 Sep 2008) - Dmitry Kurochkin patched a problem: I have found bug in pipelining through diff --git a/configure.ac b/configure.ac index fa75a4c10..d8d8b0c1f 100644 --- a/configure.ac +++ b/configure.ac @@ -163,10 +163,10 @@ m4_defun([AC_LIBTOOL_CXXCPP],[true]) m4_ifdef([AC_LIBTOOL_F77], [m4_undefine([AC_LIBTOOL_F77])]) m4_defun([AC_LIBTOOL_F77],[]) -dnl force libtool to build static libraries with PIC on AMD64-linux -AC_MSG_CHECKING([if arch-OS host is AMD64-linux (to build static libraries with PIC)]) +dnl force libtool to build static libraries with PIC on AMD64-Linux & FreeBSD +AC_MSG_CHECKING([if arch-OS host is AMD64-Linux/FreeBSD (to build static libraries with PIC)]) case $host in - x86_64*linux*) + x86_64*linux*|amd64*freebsd*|ia64*freebsd*) AC_MSG_RESULT([yes]) with_pic=yes ;; @@ -247,7 +247,7 @@ dnl ********************************************************************** case $host in # - x86_64*linux*) + x86_64*linux*|amd64*freebsd*|ia64*freebsd*) # dnl find out if icc is being used if test "z$ICC" = "z"; then diff --git a/lib/file.c b/lib/file.c index 6dd63b6a2..5e652001b 100644 --- a/lib/file.c +++ b/lib/file.c @@ -347,7 +347,7 @@ static CURLcode file_upload(struct connectdata *conn) /* treat the negative resume offset value as the case of "-" */ if(data->state.resume_from < 0) { - if(stat(file->path, &file_stat)) { + if(fstat(fileno(fp), &file_stat)) { fclose(fp); failf(data, "Can't get the size of %s", file->path); return CURLE_WRITE_ERROR; diff --git a/lib/multi.c b/lib/multi.c index 70ea38120..af355b6c7 100644 --- a/lib/multi.c +++ b/lib/multi.c @@ -321,7 +321,7 @@ static size_t fd_key_compare(void*k1, size_t k1_len, void*k2, size_t k2_len) { (void) k1_len; (void) k2_len; - return ((*((int* ) k1)) == (*((int* ) k2))) ? 1 : 0; + return (*((int* ) k1)) == (*((int* ) k2)); } static size_t hash_fd(void* key, size_t key_length, size_t slots_num) diff --git a/src/main.c b/src/main.c index e29d78212..0ea9d504d 100644 --- a/src/main.c +++ b/src/main.c @@ -4403,7 +4403,7 @@ operate(struct Configurable *config, int argc, argv_item_t argv[]) */ infd= open(uploadfile, O_RDONLY | O_BINARY); - if ((infd == -1) || stat(uploadfile, &fileinfo)) { + if ((infd == -1) || fstat(infd, &fileinfo)) { helpf(config->errors, "Can't open '%s'!\n", uploadfile); if(infd != -1) close(infd); @@ -5374,11 +5374,16 @@ rename_if_dos_device_name (char *file_name) char fname[PATH_MAX]; strncpy(fname, file_name, PATH_MAX-1); - fname[PATH_MAX-2] = 0; /* Leave room for an extra _ */ + fname[PATH_MAX-1] = 0; base = basename (fname); if (((stat(base, &st_buf)) == 0) && (S_ISCHR(st_buf.st_mode))) { size_t blen = strlen (base); + if (strlen(fname) >= PATH_MAX-1) { + /* Make room for the '_' */ + blen--; + base[blen] = 0; + } /* Prepend a '_'. */ memmove (base + 1, base, blen + 1); base[0] = '_'; |