From 5d36f5ae8200e24590eb581dec81141ffb80644b Mon Sep 17 00:00:00 2001 From: Matteo Cafasso Date: Wed, 9 Nov 2016 22:52:25 +0200 Subject: [PATCH] upload: improve file write callback As noted by Pino in another patch, the logic passes the first member of the struct which happens to be the right address to the callback function. This will break the callback if order of the members of the struct will change. As the callback is using the entire struct, better to pass the pointer to the struct itself. Signed-off-by: Matteo Cafasso --- daemon/upload.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/daemon/upload.c b/daemon/upload.c index f034627d4..8b4f60003 100644 --- a/daemon/upload.c +++ b/daemon/upload.c @@ -84,7 +84,7 @@ upload (const char *filename, int flags, int64_t offset) } } - r = receive_file (write_cb, &data.fd); + r = receive_file (write_cb, &data); if (r == -1) { /* write error */ err = errno; r = cancel_receive ();