parse-options: adjust `parse_opt_unknown_cb()`s declared return type
[gitweb.git] / pkt-line.c
index ffd722054489e6ea837bb417578afd085cebb467..c9ed780d0be02aa111786d500cd4eea2cc7ccd25 100644 (file)
@@ -350,16 +350,17 @@ enum packet_read_status packet_read_with_status(int fd, char **src_buffer,
                return PACKET_READ_EOF;
        }
 
-       if ((options & PACKET_READ_DIE_ON_ERR_PACKET) &&
-           starts_with(buffer, "ERR "))
-               die(_("remote error: %s"), buffer + 4);
-
        if ((options & PACKET_READ_CHOMP_NEWLINE) &&
            len && buffer[len-1] == '\n')
                len--;
 
        buffer[len] = 0;
        packet_trace(buffer, len, 0);
+
+       if ((options & PACKET_READ_DIE_ON_ERR_PACKET) &&
+           starts_with(buffer, "ERR "))
+               die(_("remote error: %s"), buffer + 4);
+
        *pktlen = len;
        return PACKET_READ_NORMAL;
 }