[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #49525] popen2 segfaults if command doesn't ex
From: |
Mike Miller |
Subject: |
[Octave-bug-tracker] [bug #49525] popen2 segfaults if command doesn't exist |
Date: |
Fri, 4 Nov 2016 16:46:28 +0000 (UTC) |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:49.0) Gecko/20100101 Firefox/49.0 |
Follow-up Comment #2, bug #49525 (project octave):
Making this simple change eliminates the "Inconsistency detected" message for
me
diff --git a/liboctave/wrappers/octave-popen2.c
b/liboctave/wrappers/octave-popen2.c
--- a/liboctave/wrappers/octave-popen2.c
+++ b/liboctave/wrappers/octave-popen2.c
@@ -206,7 +206,7 @@ octave_popen2 (const char *cmd, char *co
else
perror ("popen2 (child)");
- exit (0);
+ _exit (127);
}
else if (pid > 0)
{
Not the exit code, but the use of _exit instead of exit.
The message is coming from the child process as it tries to exit and call
dlclose on something (not sure what, but some shared objects that Octave has
opened). If exec() had succeeded, it would not normally run all the cleanup
that happens when exit() is called, so I think calling _exit() would be safer
anyway.
I also think it would be nice if popen2 could return a failure if the child
fails to exec, but I'm not sure how to do that in a safe way.
Anonymous, if you change exit to _exit does that fix the segfault on your
system?
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?49525>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/