diff --git a/sys/kern/subr_sbuf.c b/sys/kern/subr_sbuf.c index cd3295fd0b55..68a7b156cb34 100644 --- a/sys/kern/subr_sbuf.c +++ b/sys/kern/subr_sbuf.c @@ -706,9 +706,10 @@ sbuf_finish(struct sbuf *s) #ifdef _KERNEL return (s->s_error); #else - errno = s->s_error; - if (s->s_error) + if (s->s_error != 0) { + errno = s->s_error; return (-1); + } return (0); #endif }