summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobias Klausmann <klausman@gentoo.org>2021-01-22 13:30:34 +0100
committerTobias Klausmann <klausman@gentoo.org>2021-01-22 13:30:53 +0100
commit151740dee902b137e326f997a3e8486242b70b71 (patch)
tree6d3062261da91a29c0f3f987188d795862197bb8 /net-ftp/atftp/files
parentsys-auth/yubico-piv-tool: bump to 2.2.0 (diff)
downloadgentoo-151740dee902b137e326f997a3e8486242b70b71.tar.gz
gentoo-151740dee902b137e326f997a3e8486242b70b71.tar.bz2
gentoo-151740dee902b137e326f997a3e8486242b70b71.zip
net-ftp/atftp: Add patch that reduces # of seeks
Bug: https://bugs.gentoo.org/713672 Package-Manager: Portage-3.0.14, Repoman-3.0.2 Signed-off-by: Tobias Klausmann <klausman@gentoo.org>
Diffstat (limited to 'net-ftp/atftp/files')
-rw-r--r--net-ftp/atftp/files/atftp-0.7.2-fewer_seeks.patch38
1 files changed, 38 insertions, 0 deletions
diff --git a/net-ftp/atftp/files/atftp-0.7.2-fewer_seeks.patch b/net-ftp/atftp/files/atftp-0.7.2-fewer_seeks.patch
new file mode 100644
index 000000000000..78926b94b9f7
--- /dev/null
+++ b/net-ftp/atftp/files/atftp-0.7.2-fewer_seeks.patch
@@ -0,0 +1,38 @@
+<F28>diff -U8 atftp-0.7.2/tftp_io.c /var/tmp/portage/net-ftp/atftp-0.7.2-r1/work/atftp-0.7.2/tftp_io.c
+--- atftp-0.7.2/tftp_io.c 2019-04-14 17:38:55.000000000 -0500
++++ /var/tmp/portage/net-ftp/atftp-0.7.2-r1/work/atftp-0.7.2/tftp_io.c 2020-03-16 12:55:22.371820662 -0500
+@@ -439,26 +439,32 @@
+ }
+
+ /*
+ * Write to file and do netascii conversion if needed
+ */
+ int tftp_file_write(FILE *fp, char *data_buffer, int data_buffer_size, long block_number, int data_size,
+ int convert, long *prev_block_number, int *temp)
+ {
++ static long filepos;
+ int bytes_written;
+ int c;
+ char prevchar = *temp;
+
+ if (!convert)
+ {
+ /* Simple case, just seek and write */
+- if (fseek(fp, (block_number - 1) * data_buffer_size, SEEK_SET) != 0)
+- return 0;
++ long position = (block_number - 1)*data_buffer_size;
++ if (position != filepos)
++ if (fseek(fp, position, SEEK_SET) != 0)
++ return 0;
++ else
++ filepos = position;
+ bytes_written = fwrite(data_buffer, 1, data_size, fp);
++ filepos += bytes_written;
+ }
+ else if (block_number != *prev_block_number)
+ {
+ /*
+ * Same principle than for reading, but simpler since when client
+ * send same block twice there is no need to rewrite it to the
+ * file
+ */