Skip to content

nmtui: handle write() errors correctly in nmt_newt_edit_string

Jan Vaclav requested to merge jv/fix-newt-error-handling into main

Summary

Make it so that the function exits with an error message if the return value of write() indicates an unrecovarable write error.

Purpose

It might happen that write() returns -1, but the errno is not EINTR. In that case, the length would be incremented by 1, and the data pointer to the data being written would be moved back by 1 byte on every error.

Checklist

Please read https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/blob/main/CONTRIBUTING.md before opening the merge request. In particular, check that:

  • the subject for all commits is concise and explicative
  • the message for all commits explains the reason for the change
  • the source is properly formatted
  • any relevant documentation is up to date
  • you have added unit tests if applicable
  • the NEWS file is updated when the change deserves to be mentioned, for example for new features, behavior changes, API deprecations, etc.
Edited by Jan Vaclav

Merge request reports