Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 528928 Details for
Bug 650340
net-p2p/mktorrent-1.1 generates corrupted .torrent files when CFLAGS differ from default
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
fixes from an upstream fork
mktorrent-1.1-fix-build-for-manual-CFLAGS.patch (text/plain), 7.30 KB, created by
Nils Freydank
on 2018-04-29 16:02:18 UTC
(
hide
)
Description:
fixes from an upstream fork
Filename:
MIME Type:
Creator:
Nils Freydank
Created:
2018-04-29 16:02:18 UTC
Size:
7.30 KB
patch
obsolete
>From 4a3b25cfb67b765fd3ac66b4974ff99bb93a3890 Mon Sep 17 00:00:00 2001 >From: Nils Freydank <holgersson@posteo.de> >Date: Sun, 29 Apr 2018 17:43:30 +0200 >Subject: [PATCH 1/1] Import old fixes from Charles Clark. > >This patch incorporates old patches by Chales Clark to his own fork. > >--- > hash.c | 10 +++++----- > hash_pthreads.c | 15 ++++++++------- > init.c | 4 +++- > main.c | 3 +++ > mktorrent.h | 4 ++-- > prefix.c | 25 +++++++++++++++++++------ > 6 files changed, 40 insertions(+), 21 deletions(-) > >diff --git a/hash.c b/hash.c >index 6ac1ddf..e61dfce 100644 >--- a/hash.c >+++ b/hash.c >@@ -24,11 +24,11 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA > #include <stdio.h> /* printf() etc. */ > #include <fcntl.h> /* open() */ > #include <unistd.h> /* read(), close() */ >+#include <inttypes.h> /* PRId64 etc. */ > > #ifdef USE_OPENSSL > #include <openssl/sha.h> /* SHA1() */ > #else >-#include <inttypes.h> > #include "sha1.h" > #endif > >@@ -60,11 +60,11 @@ EXPORT unsigned char *make_hash(metafile_t *m) > unsigned char *pos; /* position in the hash string */ > unsigned char *read_buf; /* read buffer */ > int fd; /* file descriptor */ >- ssize_t r; /* number of bytes read from file(s) into >+ size_t r; /* number of bytes read from file(s) into > the read buffer */ > SHA_CTX c; /* SHA1 hashing context */ > #ifndef NO_HASH_CHECK >- off_t counter = 0; /* number of bytes hashed >+ int64_t counter = 0; /* number of bytes hashed > should match size when done */ > #endif > >@@ -144,8 +144,8 @@ EXPORT unsigned char *make_hash(metafile_t *m) > #ifndef NO_HASH_CHECK > counter += r; > if (counter != m->size) { >- fprintf(stderr, "Counted %" PRIoff " bytes, " >- "but hashed %" PRIoff " bytes. " >+ fprintf(stderr, "Counted %" PRId64 " bytes, " >+ "but hashed %" PRId64 " bytes. " > "Something is wrong...\n", m->size, counter); > exit(EXIT_FAILURE); > } >diff --git a/hash_pthreads.c b/hash_pthreads.c >index 84143b6..d563ccf 100644 >--- a/hash_pthreads.c >+++ b/hash_pthreads.c >@@ -24,10 +24,11 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA > #include <stdio.h> /* printf() etc. */ > #include <fcntl.h> /* open() */ > #include <unistd.h> /* access(), read(), close() */ >+#include <inttypes.h> /* PRId64 etc. */ >+ > #ifdef USE_OPENSSL > #include <openssl/sha.h> /* SHA1() */ > #else >-#include <inttypes.h> > #include "sha1.h" > #endif > #include <pthread.h> /* pthread functions and data structures */ >@@ -212,11 +213,11 @@ static void read_files(metafile_t *m, queue_t *q, unsigned char *pos) > { > int fd; /* file descriptor */ > flist_t *f; /* pointer to a place in the file list */ >- ssize_t r = 0; /* number of bytes read from file(s) >+ size_t r = 0; /* number of bytes read from file(s) > into the read buffer */ > #ifndef NO_HASH_CHECK >- off_t counter = 0; /* number of bytes hashed >- should match size when done */ >+ int64_t counter = 0; /* number of bytes hashed >+ should match size when done */ > #endif > piece_t *p = get_free(q, m->piece_length); > >@@ -276,8 +277,8 @@ static void read_files(metafile_t *m, queue_t *q, unsigned char *pos) > #ifndef NO_HASH_CHECK > counter += r; > if (counter != m->size) { >- fprintf(stderr, "Counted %" PRIoff " bytes, " >- "but hashed %" PRIoff " bytes. " >+ fprintf(stderr, "Counted %" PRId64 " bytes, " >+ "but hashed %" PRId64 " bytes. " > "Something is wrong...\n", m->size, counter); > exit(EXIT_FAILURE); > } >@@ -297,7 +298,7 @@ EXPORT unsigned char *make_hash(metafile_t *m) > pthread_t print_progress_thread; /* progress printer thread */ > pthread_t *workers; > unsigned char *hash_string; /* the hash string */ >- unsigned int i; >+ int i; > int err; > > workers = malloc(m->threads * sizeof(pthread_t)); >diff --git a/init.c b/init.c >index c07714c..3e8ccd8 100644 >--- a/init.c >+++ b/init.c >@@ -21,10 +21,12 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA > #include <sys/types.h> /* off_t */ > #include <errno.h> /* errno */ > #include <string.h> /* strerror() */ >-#include <stdio.h> /* printf() etc. */ >+#include <stdio.h> /* perror(), printf() etc. */ > #include <sys/stat.h> /* the stat structure */ > #include <unistd.h> /* getopt(), getcwd(), sysconf() */ > #include <string.h> /* strcmp(), strlen(), strncpy() */ >+#include <strings.h> /* strcasecmp() */ >+#include <inttypes.h> /* PRId64 etc. */ > #ifdef USE_LONG_OPTIONS > #include <getopt.h> /* getopt_long() */ > #endif >diff --git a/main.c b/main.c >index 511d036..d0488a0 100644 >--- a/main.c >+++ b/main.c >@@ -28,6 +28,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA > #ifdef ALLINONE > #include <sys/stat.h> > #include <unistd.h> /* access(), read(), close(), getcwd(), sysconf() */ >+#include <strings.h> /* strcasecmp() */ >+#include <inttypes.h> /* PRId64 etc. */ >+#include <ctype.h> /* isdigit */ > #ifdef USE_LONG_OPTIONS > #include <getopt.h> /* getopt_long() */ > #endif >diff --git a/mktorrent.h b/mktorrent.h >index 5f07a66..1e347b0 100644 >--- a/mktorrent.h >+++ b/mktorrent.h >@@ -30,7 +30,7 @@ struct flist_s; > typedef struct flist_s flist_t; > struct flist_s { > char *path; >- off_t size; >+ int64_t size; > flist_t *next; > }; > >@@ -52,7 +52,7 @@ typedef struct { > #endif > > /* information calculated by read_dir() */ >- off_t size; /* combined size of all files */ >+ int64_t size; /* combined size of all files */ > flist_t *file_list; /* list of files and their sizes */ > unsigned int pieces; /* number of pieces */ > } metafile_t; >diff --git a/prefix.c b/prefix.c >index 447772e..20f9895 100644 >--- a/prefix.c >+++ b/prefix.c >@@ -20,12 +20,19 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA > #include <stdlib.h> > #include <sys/types.h> > #include <stdio.h> >+#include <inttypes.h> > > #ifndef TYPE > #define TYPE off_t > #endif > >-int main(int argc, char *argv[]) >+#if __WORDSIZE == 32 && _FILE_OFFSET_BITS == 64 >+# define PRIdOFF_T PRId64 >+#else >+# define PRIdOFF_T PRIdPTR >+#endif >+ >+int main() > { > unsigned int i; > char *prefix[9]; >@@ -45,16 +52,22 @@ int main(int argc, char *argv[]) > #define str(s) #s > > #ifdef _LARGEFILE_SOURCE >- printf("_LARGEFILE_SOURCE is set\n"); >+ fprintf(stderr, "_LARGEFILE_SOURCE is set\n"); > #endif > > #ifdef _FILE_OFFSET_BITS >- printf("_FILE_OFFSET_BITS = %lu\n", _FILE_OFFSET_BITS); >+ fprintf(stderr, "_FILE_OFFSET_BITS = %u\n", _FILE_OFFSET_BITS); > #endif > >- printf("sizeof(" xstr(TYPE) ") = %lu, %lu bits\n", >- sizeof(TYPE), 8*sizeof(TYPE)); >-#endif /* DEBUG */ >+ fprintf(stderr, "__WORDSIZE is %d\n", __WORDSIZE); >+ fprintf(stderr, "PRIdOFF_T is " PRIdOFF_T "\n"); >+ fprintf(stderr, "sizeof(int) = %u, %u bits\n", >+ (u_int) sizeof(int), 8 * (u_int) sizeof(int)); >+ fprintf(stderr, "sizeof(long int) = %u, %u bits\n", >+ (u_int) sizeof(long int), 8 * (u_int) sizeof(long int)); >+ fprintf(stderr, "sizeof(" xstr(TYPE) ") = %u, %u bits\n", >+ (u_int) sizeof(TYPE), 8 * (u_int) sizeof(TYPE)); >+#endif /* DEBUG */ > > printf("%s\n", prefix[sizeof(TYPE)]); > >-- >2.17.0 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 650340
: 528928