1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-12-11 02:50:24 +00:00
freebsd-ports/sysutils/deltup/files/patch-bzip2.cpp
Rong-En Fan 12d695efde Add missing patch from PR:
- Build and install old versions of bzip2 which are needed by dtu's
- Patch for properly detecting and using GNU gzip (our gzip does not fit)
- Add missing dependency on misc/xdelta

PR:		ports/121517
Submitted by:	Yarodin <yarodin at gmail.com>
Approved by:	novel (maintainer, implicit)
2008-03-19 13:48:33 +00:00

39 lines
1.1 KiB
C++

--- bzip2.cpp.orig 2007-03-25 04:59:24.000000000 +0600
+++ bzip2.cpp 2008-03-09 23:37:35.000000000 +0500
@@ -19,6 +19,7 @@
#include "system.h"
#include "tmpstore.h"
#include "bzip2.h"
+#include <stdio.h>
char *bzip2_compressor_name[MAX_BZIP2_COMPRESSORS] = {"0.9.0c", "1.0.2", "1.0.3", "1.0.4"};
char *bzip2_name[MAX_BZIP2_COMPRESSORS] = {NULL, NULL, NULL, NULL};
@@ -31,14 +32,12 @@
system(command.c_str());
FILE * fp;
- char * line = NULL;
+ char line[2*CHAR_MAX];
string fname;
- size_t len = 0;
- ssize_t read;
fp = fopen(tempfile.c_str(), "r");
if (fp == NULL)
exit(EXIT_FAILURE);
- while ((read = getline(&line, &len, fp)) != -1) {
+ while (fgets(line, 2*CHAR_MAX, fp)!=NULL) {
// printf("Retrieved line of length %zu :\n", read);
// printf("%s", line);
char *v = strstr(line, "Version");
@@ -56,8 +55,8 @@
}
fname = line;
}
- if (line)
- free(line);
+// if (line)
+// free(&line);
if (verbose) {
printf("found bzip2 compressors/decompressors:\n");
for (int i = 0; i < MAX_BZIP2_COMPRESSORS; ++i) {