labath added inline comments.
================ Comment at: lldb/source/Host/common/PseudoTerminal.cpp:149 + int r = ptsname_r(m_primary_fd, buf, sizeof(buf)); + assert(r == 0); + return buf; ---------------- MaskRay wrote: > MaskRay wrote: > > labath wrote: > > > mgorny wrote: > > > > labath wrote: > > > > > mgorny wrote: > > > > > > I would really feel better with a real error handling here. It > > > > > > shouldn't be hard to use `ErrorOr` here. > > > > > Yeah, but what are you going to do with that value? Pass it to the > > > > > caller? The existing callers are ignoring the error return anyway, > > > > > and I don't want to add error handling everywhere as afaict, this > > > > > function can't fail unless the user messes up the master state (which > > > > > is not something I want to support). > > > > I get your point but I've literally wasted days because of missing > > > > error handling, so I'd really preferred if we wouldn't make it even > > > > worse. Though I guess `assert` is good enough. > > > In some ways it's even better because it will point you straight to the > > > place where the assumption is violated, whereas a propagated logic error > > > can manifest itself much farther away (or not at all). :) > > If `ptsname/ptsname_r` fails, buf will be uninitialized and trigger a > > use-of-uninitialized-value error. > ... in a -DLLVM_ENABLE_ASSERTIONS=off build. > > This probably still needs some protection. What kind of protection did you have it mind? Initialize the buffer to an empty string? Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D88728/new/ https://reviews.llvm.org/D88728 _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits