commit: 9041943e464b5d219db2101df1eebcab907e4b60
Author: NHOrus yahoo com>
AuthorDate: Wed Apr 24 10:59:21 2024 +
Commit: Viorel Munteanu gentoo org>
CommitDate: Mon Apr 29 05:18:39 2024 +
URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9041943e
net-ftp/linksys-tftp: Port to C99, fix compile on musl systems
Primary patch by Richard Narron from bug 928051
Musl fix by me.
Closes: https://bugs.gentoo.org/928051
Closes: https://bugs.gentoo.org/714212
Closes: https://bugs.gentoo.org/874582
Closes: https://bugs.gentoo.org/885699
Closes: https://bugs.gentoo.org/913577
Signed-off-by: NHOrus yahoo.com>
Closes: https://github.com/gentoo/gentoo/pull/36399
Signed-off-by: Viorel Munteanu gentoo.org>
.../files/linksys-tftp-1.2.1-r4-c99-port.patch | 572 +
net-ftp/linksys-tftp/linksys-tftp-1.2.1-r4.ebuild | 31 ++
2 files changed, 603 insertions(+)
diff --git a/net-ftp/linksys-tftp/files/linksys-tftp-1.2.1-r4-c99-port.patch
b/net-ftp/linksys-tftp/files/linksys-tftp-1.2.1-r4-c99-port.patch
new file mode 100644
index ..b4db3d2df8b0
--- /dev/null
+++ b/net-ftp/linksys-tftp/files/linksys-tftp-1.2.1-r4-c99-port.patch
@@ -0,0 +1,572 @@
+Following patches are by Richard Narron from https://bugs.gentoo.org/928051
+--- linksys-tftp-1.2.1/tftpsubs.c 2024-04-16 08:27:50.310449884 -0700
linksys-tftp-1.2.1/tftpsubs.c 2024-04-16 08:53:26.084521570 -0700
+@@ -38,6 +38,7 @@ static char sccsid[] = "@(#)tftpsubs.c 5
+ // modified tftp header to include pass
+ #include
+ #include
++#include
+
+ #define PKTSIZE (1432+4) /* SEGSIZE+4 */ /* should be moved to tftp.h */
+
+@@ -60,14 +61,22 @@ static int current; /* index of buff
+ int newline = 0;/* fillbuf: in middle of newline expansion */
+ int prevchar = -1; /* putbuf: previous char (cr check) */
+
+-struct tftphdr *rw_init();
++/* functions declared in this program */
++struct tftphdr *w_init();
++struct tftphdr *r_init();
++struct tftphdr *rw_init(int x);
++int readit(FILE *file, struct tftphdr **dpp, int convert);
++int read_ahead(FILE *file, int convert);
++int writeit(FILE *file, struct tftphdr **dpp, int ct, int convert);
++int write_behind( FILE *file, int convert);
++int synchnet(intf);
+
+ struct tftphdr *w_init() { return rw_init(0); } /* write-behind */
+ struct tftphdr *r_init() { return rw_init(1); } /* read-ahead */
+
+-struct tftphdr *
+-rw_init(x) /* init for either read-ahead or write-behind */
+-int x; /* zero for write-behind, one for read-head */
++/* init for either read-ahead or write-behind */
++struct tftphdr *rw_init(int x)
++ /* zero for write-behind, one for read-head */
+ {
+ newline = 0;/* init crlf flag */
+ prevchar = -1;
+@@ -82,10 +91,8 @@ int x; /* zero for writ
+ /* Have emptied current buffer by sending to net and getting ack.
+Free it and return next buffer filled with data.
+ */
+-readit(file, dpp, convert)
+- FILE *file; /* file opened for read */
+- struct tftphdr **dpp;
+- int convert;/* if true, convert to ascii */
++int readit(FILE *file, struct tftphdr **dpp, int convert)
++/* file opened for read if true, convert to ascii */
+ {
+ struct bf *b;
+
+@@ -104,9 +111,9 @@ readit(file, dpp, convert)
+ * fill the input buffer, doing ascii conversions if requested
+ * conversions are lf -> cr,lf and cr -> cr, nul
+ */
+-read_ahead(file, convert)
+- FILE *file; /* file opened for read */
+- int convert;/* if true, convert to ascii */
++int read_ahead(FILE *file, int convert)
++ /* file opened for read */
++ /* if true, convert to ascii */
+ {
+ register int i;
+ register char *p;
+@@ -154,16 +161,14 @@ read_ahead(file, convert)
+ *p++ = c;
+ }
+ b->counter = (int)(p - dp->th_data);
++return 0;
+ }
+
+ /* Update count associated with the buffer, get new buffer
+from the queue. Calls write_behind only if next buffer not
+available.
+ */
+-writeit(file, dpp, ct, convert)
+- FILE *file;
+- struct tftphdr **dpp;
+- int convert;
++int writeit(FILE *file, struct tftphdr **dpp, int ct, int convert)
+ {
+ bfs[current].counter = ct; /* set size of data to write */
+ current = !current; /* switch to other buffer */
+@@ -180,9 +185,7 @@ writeit(file, dpp, ct, convert)
+ * Note spec is undefined if we get CR as last byte of file or a
+ * CR followed by anything else. In this case we leave it alone.
+ */
+-write_behind(file, convert)
+- FILE *file;
+- int convert;
++int write_behind( FILE *file, int convert)
+ {
+ char *buf;
+ int count;
+@@ -238,9 +241,8 @@ skipit:
+ * when trace is active).
+ */
+
+-int
+-synchnet(f)
+-int