diff options
Diffstat (limited to 'meta-networking/recipes-daemons/tftp-hpa/files/fix-writing-emtpy-file.patch')
-rw-r--r-- | meta-networking/recipes-daemons/tftp-hpa/files/fix-writing-emtpy-file.patch | 39 |
1 files changed, 39 insertions, 0 deletions
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 000000000..452aa05f8 --- /dev/null +++ b/meta-networking/recipes-daemons/tftp-hpa/files/fix-writing-emtpy-file.patch | |||
@@ -0,0 +1,39 @@ | |||
1 | [PATCH] fix the empty file writting | ||
2 | |||
3 | Upstream-Status: pending | ||
4 | |||
5 | With the feature that checking the disk filled up, the return | ||
6 | value of function write_behind was checked and used to detect | ||
7 | the disk status. While for empty file, without data being | ||
8 | written, this function will return -1 thus the disk filled up | ||
9 | error was miss-raised. | ||
10 | |||
11 | make write_behind to return 0 if written file is empty, to fix | ||
12 | the this bug. | ||
13 | |||
14 | Signed-off-by: Roy.Li <rongqing.li@windriver.com> | ||
15 | --- | ||
16 | common/tftpsubs.c | 5 ++++- | ||
17 | 1 file changed, 4 insertions(+), 1 deletion(-) | ||
18 | |||
19 | diff --git a/common/tftpsubs.c b/common/tftpsubs.c | ||
20 | index b4ea3f2..9f6cafc 100644 | ||
21 | --- a/common/tftpsubs.c | ||
22 | +++ b/common/tftpsubs.c | ||
23 | @@ -198,9 +198,12 @@ int write_behind(FILE * file, int convert) | ||
24 | nextone = !nextone; /* incr for next time */ | ||
25 | buf = dp->th_data; | ||
26 | |||
27 | - if (count <= 0) | ||
28 | + if (count < 0) | ||
29 | return -1; /* nak logic? */ | ||
30 | |||
31 | + if (count == 0) | ||
32 | + return 0; | ||
33 | + | ||
34 | if (convert == 0) | ||
35 | return write(fileno(file), buf, count); | ||
36 | |||
37 | -- | ||
38 | 1.9.1 | ||
39 | |||