packet.c:98:2:错误:' writebuf'未申报(首次使用此功能)

时间:2018-03-09 06:02:30

标签: cygwin dropbear

我在编译它之前尝试编译dropbear for windows但现在我尝试重新编译它并格式化我以前的pc,安装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);

1 个答案:

答案 0 :(得分:0)

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

#ifdef HAVE_WRITEV

虽然使用是多次检查后面的

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

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