-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

The problems with this package are more serious than the malloc and
getenv prototypes.  Attached is a patch which uses all the correct
standard headers, and also fixes other compiler warnings.  The author
has not heard of <stdlib.h> nor <unistd.h>.

However, many of the C files in the tarball do not include any header,
leading to many warnings in other modules which use the functions
without any prototypes.  This also needs fixing.

Other compiler warnings show a pointer being dereferenced before it
has been initialised.

Lastly, the permissions in the unpacked tarball are screwed.  Many are
read-only, making editing and patching difficult.

I was going to NMU this, but in the light of the sheer number of
problems, no new upstream release, and the apparent lack of skill of
the upstream authors, it might well be safer to remove it completely.


Regards,
Roger

- -- 
Roger Leigh
                Printing on GNU/Linux?  http://gimp-print.sourceforge.net/
                Debian GNU/Linux        http://www.debian.org/
                GPG Public Key: 0x25BFB848.  Please sign and encrypt your mail.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Processed by Mailcrypt 3.5.8 <http://mailcrypt.sourceforge.net/>

iD8DBQFC0BvRVcFcaSW/uEgRAqa9AKDogwUS7nJJ9CqmoPJqC1nIcQ8B5wCgq7Xt
iSQ2Q8MRV6FaftqYfWo3cqU=
=lfKj
-----END PGP SIGNATURE-----
diff -urN mpack-1.6/codes.c mpack-1.6.mod/codes.c
--- mpack-1.6/codes.c	2003-07-21 21:51:08.000000000 +0100
+++ mpack-1.6.mod/codes.c	2005-07-09 19:34:04.578763672 +0100
@@ -128,7 +128,7 @@
     int nbytes;
     
     MD5Init(&context);
-    while (nbytes = fread(buf, 1, sizeof(buf), infile)) {
+    while ((nbytes = fread(buf, 1, sizeof(buf), infile))) {
 	length += nbytes;
 	MD5Update(&context, buf, nbytes);
     }
diff -urN mpack-1.6/debian/changelog mpack-1.6.mod/debian/changelog
--- mpack-1.6/debian/changelog	2005-07-09 19:40:03.100260120 +0100
+++ mpack-1.6.mod/debian/changelog	2005-07-09 19:15:55.379347152 +0100
@@ -1,3 +1,14 @@
+mpack (1.6-1.1) unstable; urgency=low
+
+  * Non-maintainer upload.
+  * Apply patch from Andreas Jochens to fix build failure with
+    GCC 3.4 and 4.0.  This corrects the use of non-portable and
+    non-standard prototypes for malloc() and getenv(), using the
+    versions supplied by the standard library headers instead.
+    Closes: #260652.
+
+ -- Roger Leigh <[EMAIL PROTECTED]>  Sat,  9 Jul 2005 19:13:45 +0100
+
 mpack (1.6-1) unstable; urgency=low
 
   * New upstream version, incorporating a number of Debian patches.
diff -urN mpack-1.6/decode.c mpack-1.6.mod/decode.c
--- mpack-1.6/decode.c	2003-07-21 21:47:54.000000000 +0100
+++ mpack-1.6.mod/decode.c	2005-07-09 19:28:27.272042088 +0100
@@ -26,8 +26,10 @@
  * SOFTWARE.  */
 
 #include <stdio.h>
+#include <stdlib.h>
 #include <string.h>
 #include <ctype.h>
+#include <unistd.h>
 #include "xmalloc.h"
 #include "common.h"
 #include "part.h"
diff -urN mpack-1.6/encode.c mpack-1.6.mod/encode.c
--- mpack-1.6/encode.c	2003-07-21 21:35:31.000000000 +0100
+++ mpack-1.6.mod/encode.c	2005-07-09 19:32:20.816537928 +0100
@@ -23,6 +23,7 @@
  * SOFTWARE.
  */
 #include <stdio.h>
+#include <stdlib.h>
 #include <string.h>
 
 extern char *magic_look(FILE *infile);
@@ -57,12 +58,12 @@
     /* This filename-cleaning knowledge will probably
      * be moved to the os layer in a future version.
      */
-    if (p = strrchr(cleanfname, '.')) cleanfname = p+1;
+    if ((p = strrchr(cleanfname, '.'))) cleanfname = p+1;
 #else
-    if (p = strrchr(cleanfname, '/')) cleanfname = p+1;
-    if (p = strrchr(cleanfname, '\\')) cleanfname = p+1;
+    if ((p = strrchr(cleanfname, '/'))) cleanfname = p+1;
+    if ((p = strrchr(cleanfname, '\\'))) cleanfname = p+1;
 #endif
-    if (p = strrchr(cleanfname, ':')) cleanfname = p+1;
+    if ((p = strrchr(cleanfname, ':'))) cleanfname = p+1;
 
     /* Find file type */
     if (typeoverride) {
diff -urN mpack-1.6/magic.c mpack-1.6.mod/magic.c
--- mpack-1.6/magic.c	2003-07-21 21:35:31.000000000 +0100
+++ mpack-1.6.mod/magic.c	2005-07-09 19:22:57.245213792 +0100
@@ -23,6 +23,7 @@
  * SOFTWARE.
  */
 #include <stdio.h>
+#include <string.h>
 
 /* Description of the various file formats and their magic numbers */
 struct magic {
diff -urN mpack-1.6/part.c mpack-1.6.mod/part.c
--- mpack-1.6/part.c	2005-07-09 19:40:03.098260424 +0100
+++ mpack-1.6.mod/part.c	2005-07-09 19:39:21.294615544 +0100
@@ -27,6 +27,7 @@
  */
 
 #include <stdio.h>
+#include <stdlib.h>
 #include <string.h>
 
 #include "part.h"
diff -urN mpack-1.6/unixos.c mpack-1.6.mod/unixos.c
--- mpack-1.6/unixos.c	2005-07-09 19:40:03.097260576 +0100
+++ mpack-1.6.mod/unixos.c	2005-07-09 19:34:58.218609176 +0100
@@ -23,13 +23,17 @@
  * SOFTWARE.
  */
 #include <stdio.h>
+#include <stdlib.h>
 #include <ctype.h>
 #include <string.h>
 #include <errno.h>
 #include <sys/types.h>
+#include <sys/stat.h>
 #include <sys/param.h>
+#include <time.h>
 #include <netdb.h>
 #include <fcntl.h>
+#include <unistd.h>
 #include "xmalloc.h"
 #include "common.h"
 #include "part.h"
@@ -41,8 +45,6 @@
 #ifndef errno
 extern int errno;
 #endif
-extern char *malloc();
-extern char *getenv();
 
 int overwrite_files = 0;
 int didchat;
@@ -78,7 +80,7 @@
     }
 
     result = malloc(25+strlen(hostname));
-    sprintf(result, "[EMAIL PROTECTED]", pid, curtime++, hostname);
+    sprintf(result, "[EMAIL PROTECTED]", pid, (unsigned long) curtime++, hostname);
     return result;
 }
 
@@ -196,7 +198,7 @@
 	do {
 	    if (outfile) fclose(outfile);
 	    sprintf(buf, "part%d", ++filesuffix);
-	} while (outfile = fopen(buf, "r"));
+	} while ((outfile = fopen(buf, "r")));
 	fname = buf;
     }
     else if (!overwrite_files && (outfile = fopen(fname, "r"))) {
@@ -204,7 +206,7 @@
 	    fclose(outfile);
 	    sprintf(buf, "%s.%d", fname, ++filesuffix);
 	 
-	} while (outfile = fopen(buf, "r"));
+	} while ((outfile = fopen(buf, "r")));
 	fname = buf;
     }
 
@@ -230,7 +232,7 @@
 
     p = strchr(descfname, '/');
     if (!p) p = descfname;
-    if (p = strrchr(p, '.')) *p = '\0';
+    if ((p = strrchr(p, '.'))) *p = '\0';
 
     strcat(descfname, ".desc");
     (void) rename(TEMPFILENAME, descfname);
diff -urN mpack-1.6/unixpk.c mpack-1.6.mod/unixpk.c
--- mpack-1.6/unixpk.c	2005-07-09 19:40:03.097260576 +0100
+++ mpack-1.6.mod/unixpk.c	2005-07-09 19:29:58.807126640 +0100
@@ -23,8 +23,13 @@
  * SOFTWARE.
  */
 #include <stdio.h>
+#include <stdlib.h>
 #include <string.h>
 #include <errno.h>
+#include <getopt.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+#include <unistd.h>
 #include "common.h"
 #include "version.h"
 #include "xmalloc.h"
@@ -154,7 +159,7 @@
 	    fprintf(stderr, "A subject is required\n");
 	    usage();
 	}
-	if (p = strchr(sbuf, '\n')) *p = '\0';
+	if ((p = strchr(sbuf, '\n'))) *p = '\0';
 	subject = sbuf;
     }	
 
diff -urN mpack-1.6/unixunpk.c mpack-1.6.mod/unixunpk.c
--- mpack-1.6/unixunpk.c	2005-07-09 19:40:03.097260576 +0100
+++ mpack-1.6.mod/unixunpk.c	2005-07-09 19:27:48.081999880 +0100
@@ -23,6 +23,9 @@
  * SOFTWARE.
  */
 #include <stdio.h>
+#include <stdlib.h>
+#include <getopt.h>
+#include <unistd.h>
 #include "version.h"
 #include "part.h"
 
diff -urN mpack-1.6/uudecode.c mpack-1.6.mod/uudecode.c
--- mpack-1.6/uudecode.c	2005-07-09 19:40:03.098260424 +0100
+++ mpack-1.6.mod/uudecode.c	2005-07-09 19:39:09.157460672 +0100
@@ -23,8 +23,10 @@
  * SOFTWARE.
  */
 #include <stdio.h>
+#include <stdlib.h>
 #include <ctype.h>
 #include <string.h>
+#include <unistd.h>
 #include "xmalloc.h"
 #include "common.h"
 #include "part.h"
@@ -267,7 +269,7 @@
 	}
 	else if (part == 1 && fname && !descfile &&
 		 !strncasecmp(buf, "x-file-desc: ", 13)) {
-	    if (descfile = startDescFile(fname)) {
+	    if ((descfile = startDescFile(fname))) {
 		fputs(buf+13, descfile);
 		fclose(descfile);
 		descfile = 0;
@@ -455,7 +457,7 @@
     /* Retrieve any previously saved number of the last part */
     if (nparts == 0) {
 	sprintf(buf, "%sCT", dir);
-	if (partfile = fopen(buf, "r")) {
+	if ((partfile = fopen(buf, "r"))) {
 	    if (fgets(buf, sizeof(buf), partfile)) {
 		nparts = atoi(buf);
 		if (nparts < 0) nparts = 0;
@@ -723,7 +725,7 @@
 		if (!*fname) return 1;
 
 		/* Guess the content-type of common filename extensions */
-		if (p = strrchr(fname, '.')) {
+		if ((p = strrchr(fname, '.'))) {
 		    if (!strcasecmp(p, ".gif")) contentType = "image/gif";
 		    if (!strcasecmp(p, ".jpg")) contentType = "image/jpeg";
 		    if (!strcasecmp(p, ".jpeg")) contentType = "image/jpeg";
diff -urN mpack-1.6/xmalloc.c mpack-1.6.mod/xmalloc.c
--- mpack-1.6/xmalloc.c	2003-07-21 21:35:31.000000000 +0100
+++ mpack-1.6.mod/xmalloc.c	2005-07-09 19:35:55.748863248 +0100
@@ -23,14 +23,14 @@
  * SOFTWARE.
  */
 #include <stdio.h>
+#include <stdlib.h>
 #include <string.h>
-extern char *malloc(), *realloc();
 
 char *xmalloc (int size)
 {
     char *ret;
 
-    if (ret = malloc((unsigned) size))
+    if ((ret = malloc((unsigned) size)))
       return ret;
 
     fprintf(stderr, "Memory exhausted\n");
@@ -43,7 +43,7 @@
     char *ret;
 
     /* xrealloc (NULL, size) behaves like xmalloc (size), as in ANSI C */
-    if (ret = !ptr ? malloc ((unsigned) size) : realloc (ptr, (unsigned) size))
+    if ((ret = !ptr ? malloc ((unsigned) size) : realloc (ptr, (unsigned) size)))
       return ret;
 
     fprintf(stderr, "Memory exhausted\n");

Reply via email to