Subject: RE: wu-ftpd-2.4.2-beta-18 fails on AIX 4.2

From: Mark Francis <[email-masked]>
Date: Wed, 17 Feb 1999 15:22:20 -0000

Greetings ftpd dudes,
I have tried the fixes suggested by Stefan, and they have not solved 
my problem, anymore ideas out there ?
Cheers,
Mark Francis
Analyst/Programmer
Teamwork Solutions Ltd
Phone:	+44(0) 161 228 2286
Fax:	+44(o) 161 228 2900
Email: [email-masked]
Web: http://teamwork-solutions.com

-----Original Message-----
From:	Stefan Vogel [SMTP:[email-masked]]
Sent:	17 February 1999 06:24
To:	[email-masked]
Subject:	Re: wu-ftpd-2.4.2-beta-18 fails on AIX 4.2

Hello Netters,

>
> 451 Local resource failure: malloc: No such file or directory.
>

This error message is generated in send_data because a call to malloc
is attempting to request a block of size zero. The size zero is a
consequence of a type mismatch of the parameter blksize (declared as
off_t, or long long on AIX 4.2 if _LARGE_FILES is #defined) when 
send_data is
called from retrieve. If You use the default settings for the compiler 
in
"build aix" You get /bin/cc, which is a non-ANSI compiler on AIX, so 
no
prototypes are compiled. The expression for the parameter blksize in 
the call
thus is of type int resulting in a very large value for the long long 
blksize,
but accidentally a zero in the least significant 32 bits, which then 
get casted

to the size_t (int on AIX 4.2) parameter of malloc.

The solution is not to use /bin/cc as compiler but /bin/xlc, which is 
the AIX
ANSI compiler:

  build aix CC=xlc

There is another problem on AIX 4.2: the announcement of the file size 
at the
beginning of the transfer always reports 0 bytes when using /bin/cc as 
compiler. The reason is that the correct printf format for off_t (%lld 
if
_LARGE_FILES is defined) is only selected if _AIX42 is defined. If the 
-D_AIX42 in the CFLAGS definition in src/makefiles/Makefile.aix is 
uncommented
a bug in src/config/config.aix is triggered: _LARGE_FILES only gets 
defined
if _AIX42 is undefined. This of course makes off_t int instead of long 
long
and the printf format is incorrect again, announcing very large file 
sizes.
The included patch corrects src/config/config.aix.

Btw would it be possible to document the -D_AIX42 CFLAGS addition 
somewhere
(outside Makefile.aix), e.g. NOTES or FIXES-*?

Following the patch for src/config/config.aix:

----8<--- snip --->8----
--- src/config/config.aix       Sat Oct 31 16:58:15 1998
+++ src/config/config.aix.new   Wed Feb 17 12:05:24 1999
@@ -9,7 +9,7 @@
 #define VIRTUAL
 #endif
 #endif
-#ifndef _AIX42
+#ifdef _AIX42
 #define _LARGE_FILES
 #ifndef VIRTUAL
 #define VIRTUAL
----8<--- snip --->8----

Regards

   0"0      Stefan Vogel                   Tel: ++41 1 635 67 74
  ( V )     Rechenzentrum der Universitaet FAX: ++41 1 635 45 05
   | |      CH-8057 Zuerich, Switzerland   inet: [email-masked]
---m-m------------------------------------
IBM: Solutions for a small planet! Too small!! Much too small!!!

---

From: Stefan Vogel <[email-masked]>
Date: Thu, 18 Feb 1999 13:08:05 +0100 (MET)

Hi Mark,

> my problem, anymore ideas out there ?

Try to remove -D_NO_PROTO from CFLAGS in the Makefile.aix in support/makefiles
and src/makefiles. The malloc prototype in <sys/malloc.h> is
#ifndef _NO_PROTO. If Your AIX has strdup in <string.h>, try to remove
strdup.o from OBJS in support/makefiles/Makefile.aix to avoid a redeclaration. 
Then 'build clean; build aix CC=xlc'. There will be some warnings that are
probably harmless. What version of AIX are You running?

Regards