Skip to contentSkip to conversation

Revert "tftp-hpa: bug fix on empty file put error"

PATCH Applied [email protected] 2 participants 3 messages Oct 17, 2014 – Oct 21, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 Revert "tftp-hpa: bug fix on empty file put error"

From: "Roy.Li" <[email protected]>

This reverts commit b2eb21a5fbcb065e84ed582e87de21bdc3082f00.

It make 3d8520a0b411[tftp-hpa: add error check for disk filled up] unable to work

---
 .../tftp-hpa-bug-fix-on-empty-file-put-error.patch |   33 --------------------
 .../recipes-daemons/tftp-hpa/tftp-hpa_5.2.bb       |    1 -
 2 files changed, 34 deletions(-)
 delete mode 100644 meta-networking/recipes-daemons/tftp-hpa/files/tftp-hpa-bug-fix-on-empty-file-put-error.patch
meta-networking/recipes-daemons/tftp-hpa/files/tftp-hpa-bug-fix-on-empty-file-put-error.patch deleted +0 -33
deleted file mode 100644
index aa29d9c..0000000
@@ -1,33 +0,0 @@
-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 <[email protected]>
----
- 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;
meta-networking/recipes-daemons/tftp-hpa/tftp-hpa_5.2.bb +0 -1
index e58a4b1..1951747 100644
@@ -25,7 +25,6 @@ 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"
Signature · 1 line
1.7.10.4
#1 lore raw

PATCH 2/2 tftp-hpa: fix the empty file writing error

From: "Roy.Li" <[email protected]>

make write_behind to return 0 if a empty file is written, to distinguish a true writing failure[on which the write_behind will return -1], then the annoying wrong log will disappear.

    ____
    |Error code 3: Disk full or allocation exceeded
    -----
---
 .../tftp-hpa/files/fix-writing-emtpy-file.patch    |   39 ++++++++++++++++++++
 .../recipes-daemons/tftp-hpa/tftp-hpa_5.2.bb       |    1 +
 2 files changed, 40 insertions(+)
 create mode 100644 meta-networking/recipes-daemons/tftp-hpa/files/fix-writing-emtpy-file.patch
meta-networking/recipes-daemons/tftp-hpa/files/fix-writing-emtpy-file.patch new file +39 -0
new file mode 100644
index 0000000..452aa05
@@ -0,0 +1,39 @@
+[PATCH] fix the empty file writting
+
+Upstream-Status: pending
+
+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.
+
+make write_behind to return 0 if written file is empty, to fix
+the this bug.
+
+Signed-off-by: Roy.Li <[email protected]>
+---
+ common/tftpsubs.c | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/common/tftpsubs.c b/common/tftpsubs.c
+index b4ea3f2..9f6cafc 100644
+--- a/common/tftpsubs.c
++++ b/common/tftpsubs.c
+@@ -198,9 +198,12 @@ int write_behind(FILE * file, int convert)
+     nextone = !nextone;         /* incr for next time */
+     buf = dp->th_data;
+ 
+-    if (count <= 0)
++    if (count < 0)
+         return -1;              /* nak logic? */
+ 
++    if (count == 0)
++        return 0;
++
+     if (convert == 0)
+         return write(fileno(file), buf, count);
+ 
+-- 
+1.9.1
+
meta-networking/recipes-daemons/tftp-hpa/tftp-hpa_5.2.bb +1 -0
index 1951747..3f17fd6 100644
@@ -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://fix-writing-emtpy-file.patch \
 "
 
 SRC_URI[md5sum] = "46c9bd20bbffa62f79c958c7b99aac21"
Signature · 1 line
1.7.10.4
#2 lore raw
In reply to [email protected]

Merged, thanks.
-J.

Quoted 66 lines · [[oe] [PATCH 1/2][meta-networking] Revert "tftp-hpa: bug fix on empty file put…

From: "Roy.Li" <[email protected]>

This reverts commit b2eb21a5fbcb065e84ed582e87de21bdc3082f00.

It make 3d8520a0b411[tftp-hpa: add error check for disk filled up] unable to work

---
 .../tftp-hpa-bug-fix-on-empty-file-put-error.patch |   33 --------------------
 .../recipes-daemons/tftp-hpa/tftp-hpa_5.2.bb       |    1 -
 2 files changed, 34 deletions(-)
 delete mode 100644 meta-networking/recipes-daemons/tftp-hpa/files/tftp-hpa-bug-fix-on-empty-file-put-error.patch
meta-networking/recipes-daemons/tftp-hpa/files/tftp-hpa-bug-fix-on-empty-file-put-error.patch deleted +0 -33
deleted file mode 100644
index aa29d9c..0000000
@@ -1,33 +0,0 @@
-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 <[email protected]>
----
- 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;
meta-networking/recipes-daemons/tftp-hpa/tftp-hpa_5.2.bb +0 -1
index e58a4b1..1951747 100644
@@ -25,7 +25,6 @@ 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"
Signature · 1 line
1.7.10.4
Signature · 2 lines
-Joe MacDonald.
:wq