summaryrefslogtreecommitdiffstats
path: root/qarshd.c
diff options
context:
space:
mode:
Diffstat (limited to 'qarshd.c')
-rw-r--r--qarshd.c63
1 files changed, 4 insertions, 59 deletions
diff --git a/qarshd.c b/qarshd.c
index e8a5ec7..ca812cc 100644
--- a/qarshd.c
+++ b/qarshd.c
@@ -198,8 +198,7 @@ receive_data(struct qa_packet *qp)
if (debug) syslog(LOG_DEBUG, "Transfer complete\n");
return make_qp_returncode(0, 0, "Transfer complete");
}
- if (debug) syslog(LOG_DEBUG, "Data for %d, %d@%ld\n",
- receivefd, qp->qp_data.qp_count, qp->qp_data.qp_offset);
+ if (debug) syslog(LOG_DEBUG, "Data for %d, %d\n", receivefd, qp->qp_data.qp_count);
nwrote = 0;
do {
ret = write(receivefd, qp->qp_data.qp_blob + nwrote, qp->qp_data.qp_count - nwrote);
@@ -229,60 +228,6 @@ prepare_sendfile(struct qa_packet *qp)
return NULL;
}
-ssize_t
-pushfile(const char *path)
-{
- int infd;
- off_t offset;
- ssize_t nbytes, fsize = 0;
- struct stat sb;
- const int bufsize = 16384;
- char buf[bufsize];
- struct qa_packet *qp;
-
- infd = open(path, O_RDONLY);
- if (infd == -1) {
- syslog(LOG_WARNING, "Could not open %s: %s\n",
- path, strerror(errno));
- return -1;
- }
-
- if (strcmp(saved_path, path)) {
- if (fstat(infd, &sb) < 0) {
- syslog(LOG_WARNING, "Could not stat %s: %s\n",
- path, strerror(errno));
- close(infd);
- return -1;
- } else {
- fsize = sb.st_size;
- }
- } else {
- fsize = saved_stat.st_size;
- }
- if (!fsize) {
- fprintf(stderr, "Unknown file size to send\n");
- close(infd);
- return -1;
- }
- offset = 0;
- do {
- nbytes = read(infd, buf, bufsize);
- if (nbytes < 0) {
- fprintf(stderr, "read() error: %s\n", strerror(errno));
- qp = make_qp_returncode(-1, errno, strerror(errno));
- } else {
- qp = make_qp_data(0, offset, nbytes, buf);
- }
- send_packet(qoutfd, qp);
- offset += nbytes;
- qpfree(qp);
- } while (nbytes > 0);
-
- close(infd);
-
- return offset;
-}
-
void
save_stat(const char *path, const struct stat *sb)
{
@@ -465,7 +410,7 @@ handle_qarsh()
if (nfd && FD_ISSET(childfds[1], &rfds)) {
/* Child has something to send to stdout */
nbytes = read(childfds[1], buf, allowed_out);
- qp = make_qp_data(1, 0, nbytes, buf);
+ qp = make_qp_data(1, nbytes, buf);
send_packet(qoutfd, qp);
qpfree(qp);
allowed_out -= nbytes;
@@ -479,7 +424,7 @@ handle_qarsh()
if (nfd && FD_ISSET(childfds[2], &rfds)) {
/* Child has something to send to stderr */
nbytes = read(childfds[2], buf, allowed_err);
- qp = make_qp_data(2, 0, nbytes, buf);
+ qp = make_qp_data(2, nbytes, buf);
send_packet(qoutfd, qp);
qpfree(qp);
allowed_err -= nbytes;
@@ -577,7 +522,7 @@ handle_packets()
if (nbytes == -1) {
qp = make_qp_returncode(-1, errno, strerror(errno));
} else {
- rp = make_qp_data(0, 0, nbytes, buf);
+ rp = make_qp_data(0, nbytes, buf);
if (nbytes == 0) {
close(sendfd);
sendfd = -1;