0

我正在尝试在编译之前为 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);
4

1 回答 1

0

问题似乎是由于定义受单一检查保护

#ifdef HAVE_WRITEV

而使用是在多重检查之后

#if defined(HAVE_WRITEV) && (defined(IOV_MAX) || defined(UIO_MAXIOV))

HAVE_WRITEV在 cygwin 上的 config.h 中定义,因此定义被跳过但使用检查失败并被writebuf使用。这似乎是一个上游错误。

于 2018-03-09T20:58:07.323 回答