summaryrefslogtreecommitdiffstats
path: root/qarsh/qarshd.c
diff options
context:
space:
mode:
Diffstat (limited to 'qarsh/qarshd.c')
-rw-r--r--qarsh/qarshd.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/qarsh/qarshd.c b/qarsh/qarshd.c
index 1427089..ee9e556 100644
--- a/qarsh/qarshd.c
+++ b/qarsh/qarshd.c
@@ -146,6 +146,21 @@ recvfile(const char *path, int if_port, size_t count, mode_t mode)
return count - nleft;
}
+struct qa_packet *
+rstat(const char *path)
+{
+ struct stat sb;
+ struct qa_packet *rp;
+
+ if (stat(path, &sb) < 0) {
+ rp = make_qp_returncode(-1, errno, strerror(errno));
+ } else {
+ rp = make_qp_rstat(path, &sb);
+ }
+
+ return rp;
+}
+
void
handle_packets(int infd)
{
@@ -252,6 +267,13 @@ handle_packets(int infd)
qp->qp_sendfile.qp_of_port,
qp->qp_sendfile.qp_count);
break;
+ case QP_RSTAT:
+ syslog(LOG_INFO, "Got a QP_RSTAT with path = %s\n",
+ qp->qp_rstat.qp_path);
+ rp = rstat(qp->qp_rstat.qp_path);
+ send_packet(fileno(stdout), rp);
+ qpfree(rp);
+ break;
default:
syslog(LOG_WARNING,
"Packet type %s unimplemented",