diff options
Diffstat (limited to 'networking/httpd_ratelimit_cgi.c')
| -rw-r--r-- | networking/httpd_ratelimit_cgi.c | 19 |
1 files changed, 3 insertions, 16 deletions
diff --git a/networking/httpd_ratelimit_cgi.c b/networking/httpd_ratelimit_cgi.c index 96702131e..cadaf5a07 100644 --- a/networking/httpd_ratelimit_cgi.c +++ b/networking/httpd_ratelimit_cgi.c | |||
| @@ -39,31 +39,18 @@ httpd_ratelimit_cgi.c -o httpd_ratelimit_cgi | |||
| 39 | #include <sys/stat.h> /* mkdir */ | 39 | #include <sys/stat.h> /* mkdir */ |
| 40 | #include <limits.h> | 40 | #include <limits.h> |
| 41 | 41 | ||
| 42 | static ssize_t full_write(int fd, const void *buf, size_t len) | 42 | static void full_write(int fd, const void *buf, size_t len) |
| 43 | { | 43 | { |
| 44 | ssize_t cc; | 44 | ssize_t cc; |
| 45 | ssize_t total; | ||
| 46 | |||
| 47 | total = 0; | ||
| 48 | 45 | ||
| 49 | while (len) { | 46 | while (len) { |
| 50 | cc = write(fd, buf, len); | 47 | cc = write(fd, buf, len); |
| 51 | 48 | ||
| 52 | if (cc < 0) { | 49 | if (cc < 0) |
| 53 | if (total) { | 50 | return; |
| 54 | /* we already wrote some! */ | ||
| 55 | /* user can do another write to know the error code */ | ||
| 56 | return total; | ||
| 57 | } | ||
| 58 | return cc; /* write() returns -1 on failure. */ | ||
| 59 | } | ||
| 60 | |||
| 61 | total += cc; | ||
| 62 | buf = ((const char *)buf) + cc; | 51 | buf = ((const char *)buf) + cc; |
| 63 | len -= cc; | 52 | len -= cc; |
| 64 | } | 53 | } |
| 65 | |||
| 66 | return total; | ||
| 67 | } | 54 | } |
| 68 | 55 | ||
| 69 | static void full_write2(int fd, const char *msg, const char *msg2) | 56 | static void full_write2(int fd, const char *msg, const char *msg2) |
