mirror of
https://github.com/troglobit/libite.git
synced 2026-10-01 21:42:28 +07: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:
+4
-3
@@ -41,10 +41,11 @@
|
||||
* The number of bytes copied. If an error is detected -1 is returned
|
||||
* 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;
|
||||
size_t blk = BUFSIZ, num = 0, tot = 0;
|
||||
size_t tot = 0;
|
||||
ssize_t blk = BUFSIZ, num = 0;
|
||||
|
||||
if (!src) {
|
||||
errno = EINVAL;
|
||||
@@ -73,7 +74,7 @@ size_t fsendfile(FILE *src, FILE *dst, size_t len)
|
||||
|
||||
free(buf);
|
||||
|
||||
return (num == (size_t)-1) ? (size_t)-1 : tot;
|
||||
return (num == -1) ? -1 : (ssize_t)tot;
|
||||
}
|
||||
|
||||
#ifdef UNITTEST
|
||||
|
||||
@@ -56,7 +56,7 @@ FILE *tempfile (void);
|
||||
ssize_t copyfile (char *src, char *dst, int len, int sym);
|
||||
int movefile (char *src, char *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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user