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 <noxdafox@gmail.com>
This commit is contained in:
Matteo Cafasso
2016-11-09 22:52:25 +02:00
committed by Richard W.M. Jones
parent 4152388530
commit 5d36f5ae82

View File

@@ -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 ();