mirror of
https://github.com/troglobit/libite.git
synced 2026-10-30 12:40:38 +00:00
fsendfile(): Change return type size_t --> ssize_t
Most send/recv/read/write API's return -1 on error and today use the agreed upon type ssize_t for this purpose. Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
1 parent
b2f6721813
commit
6fdffeb355
2 files changed
+5
-4
No files matched your search
+4
-3
@@ -41,10 +41,11 @@
|
|||||||
* The number of bytes copied. If an error is detected -1 is returned
|
* The number of bytes copied. If an error is detected -1 is returned
|
||||||
* and @errno will be set accordingly.
|
* and @errno will be set accordingly.
|
||||||
*/
|
*/
|
||||||
size_t fsendfile(FILE *src, FILE *dst, size_t len)
|
ssize_t fsendfile(FILE *src, FILE *dst, size_t len)
|
||||||
{
|
{
|
||||||
char *buf;
|
char *buf;
|
||||||
size_t blk = BUFSIZ, num = 0, tot = 0;
|
size_t tot = 0;
|
||||||
|
ssize_t blk = BUFSIZ, num = 0;
|
||||||
|
|
||||||
if (!src) {
|
if (!src) {
|
||||||
errno = EINVAL;
|
errno = EINVAL;
|
||||||
@@ -73,7 +74,7 @@ size_t fsendfile(FILE *src, FILE *dst, size_t len)
|
|||||||
|
|
||||||
free(buf);
|
free(buf);
|
||||||
|
|
||||||
return (num == (size_t)-1) ? (size_t)-1 : tot;
|
return (num == -1) ? -1 : (ssize_t)tot;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef UNITTEST
|
#ifdef UNITTEST
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ FILE *tempfile (void);
|
|||||||
ssize_t copyfile (char *src, char *dst, int len, int sym);
|
ssize_t copyfile (char *src, char *dst, int len, int sym);
|
||||||
int movefile (char *src, char *dst);
|
int movefile (char *src, char *dst);
|
||||||
int fcopyfile (FILE *src, FILE *dst);
|
int fcopyfile (FILE *src, FILE *dst);
|
||||||
size_t fsendfile (FILE *src, FILE *dst, size_t len);
|
ssize_t fsendfile (FILE *src, FILE *dst, size_t len);
|
||||||
|
|
||||||
int ifconfig (char *ifname, char *addr, char *mask, int up);
|
int ifconfig (char *ifname, char *addr, char *mask, int up);
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user