1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-11-26 00:55:14 +00:00
freebsd-ports/converters/mpack/files/patch-encode.c
Andrey Slusar ae2643a80f - Change TMPDIR to /tmp. [1]
- Don't use O_EXCL. [1]
- Rename touched patches to patch-<patched file> format.
- Import some fixes from Debian.

PR:		ports/93967 [1]
Submitted by:	Paul Schmehl <pauls@utdallas.edu> [1]
2006-03-26 20:45:42 +00:00

42 lines
1.2 KiB
C

--- encode.c.orig Mon Jul 21 23:35:31 2003
+++ encode.c Sun Mar 26 22:54:13 2006
@@ -23,12 +23,15 @@
* SOFTWARE.
*/
#include <stdio.h>
+#include <stdlib.h>
#include <string.h>
extern char *magic_look(FILE *infile);
extern char *os_genid(void);
extern FILE *os_createnewfile(char *fname);
extern char *md5digest(FILE *infile, long int *len);
+extern void os_perror(char *str);
+extern int to64(FILE *infile, FILE *outfile, long int limit);
#define NUMREFERENCES 4
@@ -43,7 +46,7 @@
char *type;
FILE *outfile;
char *cleanfname, *p;
- char *digest, *appledigest;
+ char *digest, *appledigest = NULL;
long filesize, l, written;
int thispart, numparts = 1;
int wrotefiletype = 0;
@@ -59,10 +62,10 @@
*/
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) {