[vlmc-devel] VLMC: call the VLMCMain function once in the code

Jean-Baptiste Kempf git at videolan.org
Sun Mar 2 16:27:57 CET 2014


vlmc | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Sun Mar  2 13:02:06 2014 +0100| [ae625ad2ff5c370c20989afd78cdc7cb8d976a6a] | committer: Jean-Baptiste Kempf

VLMC: call the VLMCMain function once in the code

And comment

> http://git.videolan.org/gitweb.cgi/vlmc.git/?a=commit;h=ae625ad2ff5c370c20989afd78cdc7cb8d976a6a
---

 src/Main/vlmc.cpp |   28 +++++++++++++++-------------
 1 file changed, 15 insertions(+), 13 deletions(-)

diff --git a/src/Main/vlmc.cpp b/src/Main/vlmc.cpp
index bd42f1e..768ad04 100644
--- a/src/Main/vlmc.cpp
+++ b/src/Main/vlmc.cpp
@@ -124,15 +124,9 @@ main( int argc, char **argv )
             pid_t pid = fork();
             if( pid < 0 )
                 vlmcFatal("Can't fork to launch VLMC. Exiting.");
-            if( pid == 0 )
-            {
-                signal( SIGSEGV, signalHandler );
-                signal( SIGFPE, signalHandler );
-                signal( SIGABRT, signalHandler );
-                signal( SIGILL, signalHandler );
-                return VLMCmain( argc, argv );
-            }
-            else
+
+            /* We're in the crash handler process */
+            if( pid != 0 )
             {
                 int status;
 
@@ -143,16 +137,24 @@ main( int argc, char **argv )
                     if ( ret == 2 )
                         continue ;
                     else
-                        break ;
+                        return ret ;
                 }
                 else
                 {
                     vlmcCritical() << "Unhandled crash.";
-                    break ;
+                    return 1;
                 }
             }
+            else /* We're actually in the program */
+            {
+                signal( SIGSEGV, signalHandler );
+                signal( SIGFPE, signalHandler );
+                signal( SIGABRT, signalHandler );
+                signal( SIGILL, signalHandler );
+                break; /* Run it */
+            }
         }
-    #else
-        return VLMCmain( argc, argv );
     #endif
+
+    return VLMCmain( argc, argv );
 }



More information about the Vlmc-devel mailing list