diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2009-03-18 17:32:44 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2009-03-18 17:32:44 +0000 |
commit | 9f57cf6604638f14390effa01b51c8ad979f14cd (patch) | |
tree | 713ecefd47867bb5d2b16c4ae3e5acd28c1c90e3 /include/libbb.h | |
parent | fce4a9454c5399c2ce8ca8e87048331c6e3d98fa (diff) | |
download | busybox-w32-9f57cf6604638f14390effa01b51c8ad979f14cd.tar.gz busybox-w32-9f57cf6604638f14390effa01b51c8ad979f14cd.tar.bz2 busybox-w32-9f57cf6604638f14390effa01b51c8ad979f14cd.zip |
ftpd: fix command fetching to not do it in 1-byte reads;
fix command de-escaping. Tested to download files with embeeded \xff and LF.
libbb: tweaks for the above
function old new delta
ftpd_main 2231 2321 +90
xmalloc_fgets_internal 190 222 +32
xmalloc_fgets_str_len - 27 +27
xmalloc_fgets_str 7 23 +16
xmalloc_fgetline_str 10 26 +16
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 4/0 up/down: 181/0) Total: 181 bytes
Diffstat (limited to 'include/libbb.h')
-rw-r--r-- | include/libbb.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/include/libbb.h b/include/libbb.h index bc47ce7ba..8ea493b18 100644 --- a/include/libbb.h +++ b/include/libbb.h | |||
@@ -594,9 +594,9 @@ extern ssize_t open_read_close(const char *filename, void *buf, size_t maxsz) FA | |||
594 | // Reads byte-by-byte. Useful when it is important to not read ahead. | 594 | // Reads byte-by-byte. Useful when it is important to not read ahead. |
595 | // Bytes are appended to pfx (which must be malloced, or NULL). | 595 | // Bytes are appended to pfx (which must be malloced, or NULL). |
596 | extern char *xmalloc_reads(int fd, char *pfx, size_t *maxsz_p) FAST_FUNC; | 596 | extern char *xmalloc_reads(int fd, char *pfx, size_t *maxsz_p) FAST_FUNC; |
597 | /* Reads block up to *maxsz_p (default: MAX_INT(ssize_t)) */ | 597 | /* Reads block up to *maxsz_p (default: INT_MAX - 4095) */ |
598 | extern void *xmalloc_read(int fd, size_t *maxsz_p) FAST_FUNC; | 598 | extern void *xmalloc_read(int fd, size_t *maxsz_p) FAST_FUNC; |
599 | /* Returns NULL if file can't be opened */ | 599 | /* Returns NULL if file can't be opened (default max size: INT_MAX - 4095) */ |
600 | extern void *xmalloc_open_read_close(const char *filename, size_t *maxsz_p) FAST_FUNC; | 600 | extern void *xmalloc_open_read_close(const char *filename, size_t *maxsz_p) FAST_FUNC; |
601 | /* Autodetects .gz etc */ | 601 | /* Autodetects .gz etc */ |
602 | extern int open_zipped(const char *fname) FAST_FUNC; | 602 | extern int open_zipped(const char *fname) FAST_FUNC; |
@@ -619,6 +619,8 @@ extern char *bb_get_chunk_from_file(FILE *file, int *end) FAST_FUNC; | |||
619 | extern char *bb_get_chunk_with_continuation(FILE *file, int *end, int *lineno) FAST_FUNC; | 619 | extern char *bb_get_chunk_with_continuation(FILE *file, int *end, int *lineno) FAST_FUNC; |
620 | /* Reads up to (and including) TERMINATING_STRING: */ | 620 | /* Reads up to (and including) TERMINATING_STRING: */ |
621 | extern char *xmalloc_fgets_str(FILE *file, const char *terminating_string) FAST_FUNC; | 621 | extern char *xmalloc_fgets_str(FILE *file, const char *terminating_string) FAST_FUNC; |
622 | /* Same, with limited max size, and returns the length (excluding NUL): */ | ||
623 | extern char *xmalloc_fgets_str_len(FILE *file, const char *terminating_string, size_t *maxsz_p) FAST_FUNC; | ||
622 | /* Chops off TERMINATING_STRING from the end: */ | 624 | /* Chops off TERMINATING_STRING from the end: */ |
623 | extern char *xmalloc_fgetline_str(FILE *file, const char *terminating_string) FAST_FUNC; | 625 | extern char *xmalloc_fgetline_str(FILE *file, const char *terminating_string) FAST_FUNC; |
624 | /* Reads up to (and including) "\n" or NUL byte: */ | 626 | /* Reads up to (and including) "\n" or NUL byte: */ |