]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
Checked in some code improvements and minor fixes that I discovered in the
authorDan Fandrich <dan@coneharvesters.com>
Wed, 10 Sep 2008 20:05:45 +0000 (20:05 +0000)
committerDan Fandrich <dan@coneharvesters.com>
Wed, 10 Sep 2008 20:05:45 +0000 (20:05 +0000)
FreeBSD ports system.

CHANGES
configure.ac
lib/file.c
lib/multi.c
src/main.c

diff --git a/CHANGES b/CHANGES
index 4d19680f14b8bc4e7902e253f7472c7408c799b4..d7084bf2dec2acc7c09219fd8bf1763776e17608 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -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
index fa75a4c10ff2d76d1645032399318fcba6a113e4..d8d8b0c1f94c8ae6e401dd974a535363ff775ac9 100644 (file)
@@ -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
index 6dd63b6a24ecf3f31688c0dbbf66ca7f71ee13d9..5e652001b9db084128afdc6dea5f6e7734e22f07 100644 (file)
@@ -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;
index 70ea38120b139ffe00d969a059abcc2803808a5a..af355b6c7d1696286ea46ad1147d321b2af11208 100644 (file)
@@ -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)
index e29d7821214fc82bd29efe154f87c2f8c81b5686..0ea9d504ddb87f79fa1e085e4d536e7fd08ed701 100644 (file)
@@ -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] = '_';