[73834] trunk/dports/security/ctool

jmr at macports.org jmr at macports.org
Fri Nov 26 11:26:41 PST 2010


Revision: 73834
          http://trac.macports.org/changeset/73834
Author:   jmr at macports.org
Date:     2010-11-26 11:26:36 -0800 (Fri, 26 Nov 2010)
Log Message:
-----------
ctool: fix 64-bit build error (#20961) and warnings

Modified Paths:
--------------
    trunk/dports/security/ctool/Portfile
    trunk/dports/security/ctool/files/patch-ctool.c

Added Paths:
-----------
    trunk/dports/security/ctool/files/patch-safe_string.c

Modified: trunk/dports/security/ctool/Portfile
===================================================================
--- trunk/dports/security/ctool/Portfile	2010-11-26 18:31:23 UTC (rev 73833)
+++ trunk/dports/security/ctool/Portfile	2010-11-26 19:26:36 UTC (rev 73834)
@@ -17,7 +17,8 @@
 depends_lib		port:openssl \
 			port:curl
 patchfiles		patch-Makefile \
-			patch-ctool.c
+			patch-ctool.c \
+			patch-safe_string.c
 use_configure		no
 build.env		CC=${configure.cc} \
 			CFLAGS=${configure.cflags} \

Modified: trunk/dports/security/ctool/files/patch-ctool.c
===================================================================
--- trunk/dports/security/ctool/files/patch-ctool.c	2010-11-26 18:31:23 UTC (rev 73833)
+++ trunk/dports/security/ctool/files/patch-ctool.c	2010-11-26 19:26:36 UTC (rev 73834)
@@ -1,6 +1,123 @@
---- ctool.c.orig	2004-04-02 08:39:45.000000000 -0600
-+++ ctool.c	2009-08-25 00:10:15.000000000 -0500
-@@ -779,7 +779,7 @@
+--- ctool.c.orig	2004-04-03 00:39:45.000000000 +1000
++++ ctool.c	2010-11-27 06:22:17.000000000 +1100
+@@ -26,12 +26,14 @@
+ 
+ #include <stdlib.h>
+ #include <stdio.h>
++#include <string.h>
+ #include <unistd.h>
+ #include <fcntl.h>
+ 
+ #include <sys/stat.h>
+ #include <sys/types.h>
+ #include <sys/errno.h>
++#include <sys/mman.h>
+ #include <sys/time.h>
+ #include <sys/param.h>
+ 
+@@ -252,12 +254,10 @@ void process_file( const char *file_path
+     struct load_command command;
+     struct stat stats;
+ 
+-    kern_return_t result;
+-
+     int fd;
+     int length;
+ 
+-    unsigned long size;
++    off_t size;
+     unsigned long index;
+     unsigned long remaining;
+     unsigned long file_pos;
+@@ -308,9 +308,13 @@ void process_file( const char *file_path
+         fprintf( stderr, "...skipping zero length file.\n" );
+         goto exit_gracefully;
+     }
++    if( size > SIZE_T_MAX )
++    {
++        size = SIZE_T_MAX;
++    }
+ 
+-    if( ( result = map_fd( (int)fd, (vm_offset_t)0, (vm_offset_t *)&addr_base,
+-                           (boolean_t)TRUE, (vm_size_t)size) ) != KERN_SUCCESS )
++    if( ( addr_base = mmap( NULL, (size_t)size, PROT_READ, MAP_FILE|MAP_PRIVATE,
++                           (int)fd, (off_t)0) ) == MAP_FAILED )
+     {
+         fprintf( stderr, "unable to map file: %s\n", path );
+         goto exit_gracefully;
+@@ -405,13 +409,13 @@ print_hash:
+ 
+     if( debug )
+     {
+-        int bytes_excluded = ( size - bytes_read );
++        size_t bytes_excluded = ( size - bytes_read );
+ 
+-        fprintf( stdout, "file size: (%d) bytes.\n", size );
++        fprintf( stdout, "file size: (%llu) bytes.\n", size );
+ 
+         if( has_prebinding )
+         {
+-            fprintf( stdout, "excluded a total of %d bytes from checksum.\n",
++            fprintf( stdout, "excluded a total of %lu bytes from checksum.\n",
+                      bytes_excluded );
+         }
+     }
+@@ -517,7 +521,7 @@ void checksum_section( const char *segme
+ 
+             if( debug )
+             {
+-             fprintf( stdout, "...read section %s,%s (offset=%lu,size=%lu).\n",
++             fprintf( stdout, "...read section %s,%s (offset=%u,size=%u).\n",
+                          segment_name, section_name, section.offset,
+                          section.size );
+             }
+@@ -687,14 +691,14 @@ void print_stats( const char *file_path,
+         struct group *grp;
+ 
+         fprintf( stdout, "\nstats for (%s):\n\n", file_path );
+-        fprintf( stdout, "      device: %lu\n", stats->st_dev );
+-        fprintf( stdout, "       inode: %lu\n", stats->st_ino );
++        fprintf( stdout, "      device: %u\n", stats->st_dev );
++        fprintf( stdout, "       inode: %llu\n", (uint64_t)stats->st_ino );
+ 
+         /* file permissisons string.*/
+ 
+         get_file_attribute_string( buffer, sizeof(buffer), stats->st_mode );
+-        fprintf( stdout, "        mode: %s (%lu)\n", buffer, stats->st_mode );
+-        fprintf( stdout, "       links: %lu\n", stats->st_nlink );
++        fprintf( stdout, "        mode: %s (%hu)\n", buffer, stats->st_mode );
++        fprintf( stdout, "       links: %hu\n", stats->st_nlink );
+ 
+         /* display user and group names. */
+ 
+@@ -714,10 +718,10 @@ void print_stats( const char *file_path,
+             safe_strlcpy( group, grp->gr_name, sizeof( group ) );
+         }
+ 
+-        fprintf( stdout, "         uid: %lu %s\n", stats->st_uid, name );
+-        fprintf( stdout, "         gid: %lu %s\n", stats->st_gid, group );
++        fprintf( stdout, "         uid: %u %s\n", stats->st_uid, name );
++        fprintf( stdout, "         gid: %u %s\n", stats->st_gid, group );
+ 
+-        fprintf( stdout, "        rdev: %lu\n", stats->st_rdev );
++        fprintf( stdout, "        rdev: %u\n", stats->st_rdev );
+ 
+        /* mtime. */
+ 
+@@ -748,9 +752,9 @@ void print_stats( const char *file_path,
+ 
+         fprintf( stdout, "       bytes: %llu\n", stats->st_size );
+         fprintf( stdout, "      blocks: %llu\n", stats->st_blocks );
+-        fprintf( stdout, "  block size: %lu\n", stats->st_blksize );
+-        fprintf( stdout, "       flags: %lu\n", stats->st_flags );
+-        fprintf( stdout, "  gen number: %lu\n", stats->st_gen );
++        fprintf( stdout, "  block size: %u\n", stats->st_blksize );
++        fprintf( stdout, "       flags: %lu\n", (unsigned long)stats->st_flags );
++        fprintf( stdout, "  gen number: %lu\n", (unsigned long)stats->st_gen );
+ 
+         fprintf( stdout, "\n" );
+     }
+@@ -779,7 +783,7 @@ void verify_with_knowngoods( const char 
          safe_strlcat( kg_get_url, file_hash, sizeof( kg_get_url ) );
  
          curl_easy_setopt( curl, CURLOPT_URL, kg_get_url );

Added: trunk/dports/security/ctool/files/patch-safe_string.c
===================================================================
--- trunk/dports/security/ctool/files/patch-safe_string.c	                        (rev 0)
+++ trunk/dports/security/ctool/files/patch-safe_string.c	2010-11-26 19:26:36 UTC (rev 73834)
@@ -0,0 +1,10 @@
+--- safe_string.c.orig	2003-02-27 15:23:45.000000000 +1100
++++ safe_string.c	2010-11-27 05:11:15.000000000 +1100
+@@ -26,6 +26,7 @@
+ #include <stdlib.h>
+ #include <stdio.h>
+ #include <stdarg.h>
++#include <string.h>
+ 
+ #include "safe_string.h"
+ 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20101126/2e3a2ba8/attachment.html>


More information about the macports-changes mailing list