--- mpack-1.6.old/common.h +++ mpack-1.6/common.h @@ -24,9 +24,9 @@ */ #ifdef __riscos -#define TEMPFILENAME "TempDesc" +#define TEMPFILEBASE "TempDesc" #else -#define TEMPFILENAME "tempdesc.txt" +#define TEMPFILEBASE "/var/tmp/tempdesc" #endif #if defined(unix) && !defined(remove) @@ -44,3 +44,5 @@ #define strchr index #define strrchr rindex #endif + +extern char *os_tfname (void); --- mpack-1.6.old/decode.c +++ mpack-1.6/decode.c @@ -88,9 +88,13 @@ return ignoreMessage(inpart); } else if (!strncasecmp(contentType, "multipart/", 10)) { + +#ifdef NOTDEF // Suppress problematic warning if (contentEncoding != enc_none) { warn("ignoring invalid content encoding on multipart"); } +#endif // Endif NOTDEF + return handleMultipart(inpart, contentType, contentParams, extractText); } @@ -106,7 +110,12 @@ !strncasecmp(contentType, "text/", 5) && !getDispositionFilename(contentDisposition) && !getParam(contentParams, "name")) { +#ifdef NOTDEF // Old code return handleText(inpart, contentEncoding); +#else // Experimental change + ignoreMessage (inpart); + return 1; +#endif // Endif NOTDEF } else { /* Some sort of attachment, extract it */ @@ -852,7 +861,7 @@ ignoreMessage(inpart); /* Remove any lingering unused description file */ - (void) remove(TEMPFILENAME); + (void) remove (os_tfname()); return 0; } @@ -865,9 +874,9 @@ { FILE *descfile; - descfile = os_createnewfile(TEMPFILENAME); + descfile = os_createnewfile (os_tfname()); if (!descfile) { - os_perror(TEMPFILENAME); + os_perror (os_tfname()); ignoreMessage(inpart); return 1; } --- mpack-1.6.old/unixos.c +++ mpack-1.6/unixos.c @@ -187,7 +187,7 @@ (void) mkdir(fname, 0777); *p = '/'; } - else if (!isprint(*p) || strchr(BADCHARS, *p)) *p = 'X'; + else if (!isprint(*p) || strchr(BADCHARS, *p)) *p = '_'; } if (!fname[0]) { @@ -231,7 +231,8 @@ if (p = strrchr(p, '.')) *p = '\0'; strcat(descfname, ".desc"); - (void) rename(TEMPFILENAME, descfname); + + (void) rename (os_tfname(), descfname); if (descfname != buf) free(descfname); fprintf(stdout, "%s (%s)\n", output_fname, contentType); @@ -279,3 +280,10 @@ { perror(file); } + +char *os_tfname (void) +{ + static char tfnamebuf [1024]; + sprintf (tfnamebuf, "%s-%d-%d", TEMPFILEBASE, getuid(), getpid()); + return (tfnamebuf); +} --- mpack-1.6.old/uudecode.c +++ mpack-1.6/uudecode.c @@ -673,7 +673,7 @@ sprintf(buf, "%s0", dir); infile = fopen(buf, "r"); if (infile) { - outfile = os_createnewfile(TEMPFILENAME); + outfile = os_createnewfile (os_tfname()); if (outfile) { while (fgets(buf, sizeof(buf), infile)) { fputs(buf, outfile); @@ -695,7 +695,7 @@ if (!infile) { os_perror(buf); if (outfile) fclose(outfile); - remove(TEMPFILENAME); + remove (os_tfname()); return 1; } ===== end of patch =====