packet.c:98:2: error: 'writebuf' undeclared (first use in this function)
packet.c:98:2: error: 'writebuf' undeclared (first use in this function)
我在编译之前尝试为 windows 编译 dropbear,但现在我尝试重新编译它并格式化我以前的电脑,安装 cygwin 以及必要的东西,但是当我执行 make 命令时,它给了我那个错误。但是我不明白为什么它说没有声明,如果在那里清楚地看到它,我会很感激你的帮助。
ERROR: "packet.c: In function 'write_packet':
packet.c:98:2: error: 'writebuf' undeclared (first use in this function)
writebuf = (buffer*)examine(&ses.writequeue);"
CODE:
#ifdef HAVE_WRITEV
/* 50 is somewhat arbitrary */
unsigned int iov_count = 50;
struct iovec iov[50];
#else
int len;
buffer* writebuf;
int packet_type;
#endif
TRACE2(("enter write_packet"))
dropbear_assert(!isempty(&ses.writequeue));
#if defined(HAVE_WRITEV) && (defined(IOV_MAX) || defined(UIO_MAXIOV))
packet_queue_to_iovec(&ses.writequeue, iov, &iov_count);
/* This may return EAGAIN. The main loop sometimes
calls write_packet() without bothering to test with select() since
it's likely to be necessary */
written = writev(ses.sock_out, iov, iov_count);
if (written < 0) {
if (errno == EINTR || errno == EAGAIN) {
TRACE2(("leave write_packet: EINTR"))
return;
} else {
dropbear_exit("Error writing: %s", strerror(errno));
}
}
packet_queue_consume(&ses.writequeue, written);
ses.writequeue_len -= written;
if (written == 0) {
ses.remoteclosed();
}
#else /* No writev () */
/* Get the next buffer in the queue of encrypted packets to write*/
writebuf = (buffer*)examine(&ses.writequeue);
/* The last byte of the buffer is not to be transmitted, but is
* a cleartext packet_type indicator */
packet_type = writebuf->data[writebuf->len-1];
len = writebuf->len - 1 - writebuf->pos;
TRACE2(("write_packet type %d len %d/%d", packet_type,
len, writebuf->len-1))
dropbear_assert(len > 0);
问题似乎是由于定义受单一检查保护
#ifdef HAVE_WRITEV
虽然使用是在多重检查之后
#if defined(HAVE_WRITEV) && (defined(IOV_MAX) || defined(UIO_MAXIOV))
HAVE_WRITEV
在cygwin的config.h中定义,所以定义被跳过但是使用检查失败并使用writebuf
。
这似乎是一个上游错误。
我在编译之前尝试为 windows 编译 dropbear,但现在我尝试重新编译它并格式化我以前的电脑,安装 cygwin 以及必要的东西,但是当我执行 make 命令时,它给了我那个错误。但是我不明白为什么它说没有声明,如果在那里清楚地看到它,我会很感激你的帮助。
ERROR: "packet.c: In function 'write_packet':
packet.c:98:2: error: 'writebuf' undeclared (first use in this function)
writebuf = (buffer*)examine(&ses.writequeue);"
CODE:
#ifdef HAVE_WRITEV
/* 50 is somewhat arbitrary */
unsigned int iov_count = 50;
struct iovec iov[50];
#else
int len;
buffer* writebuf;
int packet_type;
#endif
TRACE2(("enter write_packet"))
dropbear_assert(!isempty(&ses.writequeue));
#if defined(HAVE_WRITEV) && (defined(IOV_MAX) || defined(UIO_MAXIOV))
packet_queue_to_iovec(&ses.writequeue, iov, &iov_count);
/* This may return EAGAIN. The main loop sometimes
calls write_packet() without bothering to test with select() since
it's likely to be necessary */
written = writev(ses.sock_out, iov, iov_count);
if (written < 0) {
if (errno == EINTR || errno == EAGAIN) {
TRACE2(("leave write_packet: EINTR"))
return;
} else {
dropbear_exit("Error writing: %s", strerror(errno));
}
}
packet_queue_consume(&ses.writequeue, written);
ses.writequeue_len -= written;
if (written == 0) {
ses.remoteclosed();
}
#else /* No writev () */
/* Get the next buffer in the queue of encrypted packets to write*/
writebuf = (buffer*)examine(&ses.writequeue);
/* The last byte of the buffer is not to be transmitted, but is
* a cleartext packet_type indicator */
packet_type = writebuf->data[writebuf->len-1];
len = writebuf->len - 1 - writebuf->pos;
TRACE2(("write_packet type %d len %d/%d", packet_type,
len, writebuf->len-1))
dropbear_assert(len > 0);
问题似乎是由于定义受单一检查保护
#ifdef HAVE_WRITEV
虽然使用是在多重检查之后
#if defined(HAVE_WRITEV) && (defined(IOV_MAX) || defined(UIO_MAXIOV))
HAVE_WRITEV
在cygwin的config.h中定义,所以定义被跳过但是使用检查失败并使用writebuf
。
这似乎是一个上游错误。