tftp-hpa: bug fix on empty file put error
authorzhangxiao <xiao.zhang@windriver.com>
Thu, 4 Sep 2014 09:40:17 +0000 (17:40 +0800)
committerPatrick Ohly <patrick.ohly@intel.com>
Fri, 9 Jan 2015 16:42:25 +0000 (08:42 -0800)
With the feature that checking the disk filled up, the return value of
function write_behind was checked and used to detect the disk status.
While for empty file, without data being written, this function will
return -1 thus the disk filled up error was miss-raised. Fix it.

(From meta-openembedded rev: ed698c4dba606b9d0c36c68023004046417db251)

Signed-off-by: Zhang Xiao <xiao.zhang@windriver.com>
Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
meta-openembedded/meta-networking/recipes-daemons/tftp-hpa/files/tftp-hpa-bug-fix-on-empty-file-put-error.patch [new file with mode: 0644]
meta-openembedded/meta-networking/recipes-daemons/tftp-hpa/tftp-hpa_5.2.bb

diff --git a/meta-openembedded/meta-networking/recipes-daemons/tftp-hpa/files/tftp-hpa-bug-fix-on-empty-file-put-error.patch b/meta-openembedded/meta-networking/recipes-daemons/tftp-hpa/files/tftp-hpa-bug-fix-on-empty-file-put-error.patch
new file mode 100644 (file)
index 0000000..aa29d9c
--- /dev/null
@@ -0,0 +1,33 @@
+tftp-hpa: bug fix on empty file put error
+
+With the feature that checking the disk filled up, the return value of
+function write_behind was checked and used to detect the disk status.
+While for empty file, without data being written, this function will
+return -1 thus the disk filled up error was miss-raised. Fix it.
+
+Upstream-Status: pending
+
+Signed-off-by: Zhang Xiao <xiao.zhang@windriver.com>
+---
+ tftpd/tftpd.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+--- a/tftpd/tftpd.c
++++ b/tftpd/tftpd.c
+@@ -1692,7 +1692,7 @@ static void tftp_recvfile(const struct f
+             syslog(LOG_WARNING, "tftpd: write(ack): %m");
+             goto abort;
+         }
+-        if(write_behind(file, pf->f_convert) < 0) {
++        if(write_behind(file, pf->f_convert) < -1) {
+             nak(ENOSPACE, NULL);
+             (void)fclose(file);
+             goto abort;
+@@ -1727,7 +1727,7 @@ static void tftp_recvfile(const struct f
+             goto abort;
+         }
+     } while (size == segsize);
+-    if(write_behind(file, pf->f_convert) < 0) {
++    if(write_behind(file, pf->f_convert) < -1) {
+         nak(ENOSPACE, NULL);
+         (void)fclose(file);
+         goto abort;
index 1951747..e58a4b1 100644 (file)
@@ -25,6 +25,7 @@ SRC_URI = "http://kernel.org/pub/software/network/tftp/tftp-hpa/tftp-hpa-${PV}.t
            file://init \
            file://add-error-check-for-disk-filled-up.patch \
            file://tftp-hpa-bug-fix-on-separated-CR-and-LF.patch \
+           file://tftp-hpa-bug-fix-on-empty-file-put-error.patch \
 "
 
 SRC_URI[md5sum] = "46c9bd20bbffa62f79c958c7b99aac21"