FLTK logo

[master] 16af5f4 - Avoid Linux warning

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 All Forums  |  Back to fltk.commit  ]
 
Previous Message ]Next Message ]

[master] 16af5f4 - Avoid Linux warning "Matthias Melcher" Jan 29, 2023  
 
commit 16af5f432e9f7cc62b7205d47c147e1fc5909e94
Author:     Matthias Melcher <github@matthiasm.com>
AuthorDate: Sun Jan 29 13:49:37 2023 +0100
Commit:     Matthias Melcher <github@matthiasm.com>
CommitDate: Sun Jan 29 13:49:37 2023 +0100

    Avoid Linux warning

 fluid/ExternalCodeEditor_UNIX.cxx | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git fluid/ExternalCodeEditor_UNIX.cxx fluid/ExternalCodeEditor_UNIX.cxx
index 2a8f8a5..e1e2c0e 100644
--- fluid/ExternalCodeEditor_UNIX.cxx
+++ fluid/ExternalCodeEditor_UNIX.cxx
@@ -402,7 +402,9 @@ int ExternalCodeEditor::start_editor(const char *editor_cmd,
         execvp(args[0], args);  // run command - doesn't return if succeeds
         if (alert_pipe_open_) {
           int err = errno;
-          ::write(alert_pipe_[1], &err, sizeof(int));
+          if (::write(alert_pipe_[1], &err, sizeof(int)) != sizeof(int)) {
+            // should not happen, but if it does, at least we tried
+          }
         }
         exit(1);
       }
@@ -555,7 +557,8 @@ int ExternalCodeEditor::editors_open() {
 void ExternalCodeEditor::alert_pipe_cb(FL_SOCKET s, void* d) {
   ExternalCodeEditor* self = (ExternalCodeEditor*)d;
   self->last_error_ = 0;
-  ::read(s, &self->last_error_, sizeof(int));
+  if (::read(s, &self->last_error_, sizeof(int)) != sizeof(int))
+    return;
   const char* cmd = self->command_line_.value();
   if (cmd && *cmd) {
     if (cmd[0] == '/') { // is this an absoluet filename?
Direct Link to Message ]
 
     
Previous Message ]Next Message ]
 
 

Comments are owned by the poster. All other content is copyright 1998-2024 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.