summaryrefslogtreecommitdiff
path: root/archivers/libcabinet/files/patch-cfcreate.cpp
diff options
context:
space:
mode:
authorEdwin Groothuis <edwin@FreeBSD.org>2003-08-31 13:09:31 +0000
committerEdwin Groothuis <edwin@FreeBSD.org>2003-08-31 13:09:31 +0000
commit8a8b31d05cd02391ec25bd1600ee963651314cb2 (patch)
tree51f9d0c5cf9417d032d59d737d75e7aa133b785d /archivers/libcabinet/files/patch-cfcreate.cpp
parent- New port mail/p5-Email-FolderType: Determine the type of a (diff)
[patch] Unbreak port: archivers/libcabinet
This port did not build with gcc 3.3.1. I also fixed a possible buffer overflow (they used gets() to read from stdin). Please review the patch file ``patch-cftypes.cpp'' with extra care, since I am not sure whether this makes sense (2 positions in the file, marked with ``TODO'' - thanks. Also added some lines in cftypes.cpp to overcome the absence of values.h on -current. PR: ports/55767 Submitted by: Simon Barner <barner@in.tum.de>
Diffstat (limited to 'archivers/libcabinet/files/patch-cfcreate.cpp')
-rw-r--r--archivers/libcabinet/files/patch-cfcreate.cpp38
1 files changed, 38 insertions, 0 deletions
diff --git a/archivers/libcabinet/files/patch-cfcreate.cpp b/archivers/libcabinet/files/patch-cfcreate.cpp
new file mode 100644
index 000000000000..2e7bc80ea315
--- /dev/null
+++ b/archivers/libcabinet/files/patch-cfcreate.cpp
@@ -0,0 +1,38 @@
+--- cfcreate.cpp.orig Sun Oct 24 13:29:53 1999
++++ cfcreate.cpp Tue Aug 19 21:16:05 2003
+@@ -29,6 +29,8 @@
+ #include <unistd.h>
+ #endif
+
++using std::ios;
++
+ ///////////////////////////////////////***************************************
+
+ int cfc_fileinfo::write_entry(ostream& out)
+@@ -129,7 +131,7 @@
+ }
+ }
+
+- if(fstat(in.rdbuf()->fd(), &statbuf) != 0) return FSTAT_FAILURE;
++ if(stat(fname, &statbuf) != 0) return FSTAT_FAILURE;
+ #ifndef unix
+ if(getftime(in.rdbuf()->fd(), &datetime) != 0) return GETTIME_FAILURE;
+ #endif
+@@ -194,7 +196,7 @@
+ unprocessed_data = NULL; // Reset buffer holder
+ unprocessed_data_len = 0u;
+
+- if(in.read(buf + bytesread, len - bytesread).bad())
++ if(in.read((char*)buf + bytesread, len - bytesread).bad())
+ {
+ delete[] buf;
+ buf = NULL;
+@@ -272,7 +274,7 @@
+ return WRITE_ERROR;
+ }
+
+- tempfile->write(compdata, blockinfo.compressed_len);
++ tempfile->write((char*)compdata, blockinfo.compressed_len);
+ processed_bytes += sizeof(blockinfo) + blockinfo.compressed_len;
+ if(compdata != data) delete[] compdata; // If buffer was allocated, free it
+ data_blocks++; // Incriment block counter