Message ID | 20240403172216.3254805-7-gerickson@nuovations.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | [RFC,v6] ell/term: Return error on writes if the output descriptor is invalid. | expand |
Context | Check | Description |
---|---|---|
tedd_an/pre-ci_am | fail | error: ell/term.c: does not exist in index hint: Use 'git am --show-current-patch' to see the failed patch |
diff --git a/ell/term.c b/ell/term.c index 4c31c0761a79..29d31987939a 100644 --- a/ell/term.c +++ b/ell/term.c @@ -391,6 +391,9 @@ LIB_EXPORT int l_term_putnstr(struct l_term *term, const char *str, size_t n) if (!term) return -EINVAL; + if (term->out_fd < 0) + return -EBADF; + res = write(term->out_fd, str, n); if (res < 0) return -errno; @@ -432,6 +435,9 @@ LIB_EXPORT int l_term_vprint(struct l_term *term, const char *str, va_list ap) if (!term || !str) return -EINVAL; + if (term->out_fd < 0) + return -EBADF; + if (vdprintf(term->out_fd, str, ap) < 0) return -errno;