[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Cannot compile checkinstall on x86_64



On Saturday 07 April 2007 03:18, you wrote:
> Here is the relevant section. Let me know if you want more information.
>
> Thanks,
> kc
>
> 765 #if defined __USE_BSD || defined __USE_XOPEN_EXTENDED || defined
> __USE_XOPE     N2K
>  766 /* Make a symbolic link to FROM named TO.  */
>  767 extern int symlink (__const char *__from, __const char *__to)
>  768      __THROW __nonnull ((1, 2)) __wur;
>  769
>  770 /* Read the contents of the symbolic link PATH into no more than
>  771    LEN bytes of BUF.  The contents are not null-terminated.
>  772    Returns the number of characters read, or -1 for errors.  */
>  773 extern ssize_t readlink (__const char *__restrict __path,
>  774                          char *__restrict __buf, size_t __len)
>  775      __THROW __nonnull ((1, 2)) __wur;
>  776 #endif /* Use BSD.  */

This is interesting. My version of unistd.h defines readlink as an int, while 
yours has ssize_t type. And, indeed, readlink(2) says it should be a ssize_t. 
I don't get why is this. The thing is that installwatch uses int for the 
definition, and I guess ssize_t in 64 bit archs is a long instead of an int, 
which causes the problem.

Anyways, the attached patch should get you to compile in 64 bit archs (as well 
as 32 bit archs: it compiles in my system).



-- 

	Felipe Sateler
--- installwatch.c.svn-base	2007-04-07 14:27:23.000000000 -0400
+++ installwatch.c	2007-04-07 14:25:06.000000000 -0400
@@ -84,7 +84,7 @@
 static int (*true_open)(const char *, int, ...);
 static DIR *(*true_opendir)(const char *);
 static struct dirent *(*true_readdir)(DIR *dir);
-static int (*true_readlink)(const char*,char *,size_t);
+static ssize_t (*true_readlink)(const char*,char *,size_t);
 static char *(*true_realpath)(const char *,char *);
 static int (*true_rename)(const char *, const char *);
 static int (*true_rmdir)(const char *);
@@ -546,7 +546,7 @@
 	struct utimbuf timbuf;
 	size_t truesz;
 	char linkpath[PATH_MAX+1];
-	size_t linksz;
+	ssize_t linksz;
 
 #if DEBUG
 	debug(2,"copy_path(%s,%s)\n",truepath,translroot);
@@ -1582,7 +1582,7 @@
 	struct stat reslvinfo;
 	instw_t iw;
 	char wpath[PATH_MAX+1];
-	size_t wsz=0;
+	ssize_t wsz=0;
 	char linkpath[PATH_MAX+1];
 
 
@@ -2698,8 +2698,8 @@
 	return result;
 }
 
-int readlink(const char *path,char *buf,size_t bufsiz) {
-	int result;
+ssize_t readlink(const char *path,char *buf,size_t bufsiz) {
+	ssize_t result;
 	instw_t instw;
 	int status;