Write header to stdout target.
This commit is contained in:
@@ -2,6 +2,7 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
|
#include "buf.h"
|
||||||
#include "incoming.h"
|
#include "incoming.h"
|
||||||
#include "outgoing.h"
|
#include "outgoing.h"
|
||||||
#include "peer.h"
|
#include "peer.h"
|
||||||
@@ -97,6 +98,17 @@ bool opts_add_stdout(char *arg) {
|
|||||||
if (!serializer) {
|
if (!serializer) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
send_new(dup(1), serializer, NULL);
|
int fd = dup(1);
|
||||||
|
{
|
||||||
|
// TODO: move into standard location for non-socket fd handling
|
||||||
|
struct buf buf = BUF_INIT, *buf_ptr = &buf;
|
||||||
|
send_hello(&buf_ptr, serializer);
|
||||||
|
if (buf_ptr->length) {
|
||||||
|
if (write(fd, buf_at(buf_ptr, 0), buf_ptr->length) != (ssize_t) buf_ptr->length) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
send_new(fd, serializer, NULL);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user