summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--server.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/server.c b/server.c
index 7bc991a..15f8a88 100644
--- a/server.c
+++ b/server.c
@@ -11,14 +11,18 @@
#include <sys/sendfile.h>
#include <unistd.h>
-int shsd_sendfile(int in_fd, FILE *ou_fd, struct stat *s)
+int shsd_sendfile(int in_fd, FILE *ou_fd)
{
- int stat_result = fstat(fileno(ou_fd), s);
+ struct stat s;
+ int stat_result = fstat(fileno(ou_fd), &s);
if (stat_result != 0) {
perror("fstat");
return -1;
}
- sendfile(in_fd, fileno(ou_fd), NULL, s->st_size);
+ sendfile(in_fd, fileno(ou_fd), NULL, s.st_size);
+
+ return 0;
+}
return 0;
}