From 4cc73f63aa5fa4e1883be9114c3a992e2266ee60 Mon Sep 17 00:00:00 2001 From: "Roy.Li" Date: Fri, 17 Oct 2014 13:24:24 +0800 Subject: tftp-hpa: fix the empty file writing error 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 ----- Signed-off-by: Roy.Li Signed-off-by: Joe MacDonald --- .../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 diff --git a/meta-networking/recipes-daemons/tftp-hpa/files/fix-writing-emtpy-file.patch b/meta-networking/recipes-daemons/tftp-hpa/files/fix-writing-emtpy-file.patch new file mode 100644 index 0000000000..452aa05f81 --- /dev/null +++ b/meta-networking/recipes-daemons/tftp-hpa/files/fix-writing-emtpy-file.patch @@ -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 +--- + 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 + diff --git a/meta-networking/recipes-daemons/tftp-hpa/tftp-hpa_5.2.bb b/meta-networking/recipes-daemons/tftp-hpa/tftp-hpa_5.2.bb index 19517473fe..3f17fd6fc2 100644 --- a/meta-networking/recipes-daemons/tftp-hpa/tftp-hpa_5.2.bb +++ b/meta-networking/recipes-daemons/tftp-hpa/tftp-hpa_5.2.bb @@ -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" -- cgit v1.2.3-54-g00ecf