aboutsummaryrefslogtreecommitdiffstats
path: root/meta-networking/recipes-daemons/tftp-hpa/files/tftp-hpa-bug-fix-on-empty-file-put-error.patch
blob: aa29d9ce1ce1c78dfe6605eaf5b4c373e0d5c82a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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;