[vlc-commits] vlc: return non-zero exit code if starting failed

Rémi Denis-Courmont git at videolan.org
Fri Nov 30 19:30:08 CET 2012


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Fri Nov 30 20:29:43 2012 +0200| [f3a44a5f35b9c1eab0ae0325ef1b98962e04b450] | committer: Rémi Denis-Courmont

vlc: return non-zero exit code if starting failed

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

 bin/vlc.c |   11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/bin/vlc.c b/bin/vlc.c
index 198f28f..9546077 100644
--- a/bin/vlc.c
+++ b/bin/vlc.c
@@ -234,8 +234,9 @@ int main( int i_argc, const char *ppsz_argv[] )
     /* Initialize libvlc */
     libvlc_instance_t *vlc = libvlc_new (argc, argv);
     if (vlc == NULL)
-        goto out;
+        return 1;
 
+    int ret = 1;
     libvlc_set_exit_handler (vlc, vlc_kill, &self);
     libvlc_set_user_agent (vlc, "VLC media player", "VLC/"PACKAGE_VERSION);
 
@@ -275,15 +276,13 @@ int main( int i_argc, const char *ppsz_argv[] )
     pthread_sigmask (SIG_UNBLOCK, &set, NULL);
     alarm (3);
 
+    ret = 0;
     /* Cleanup */
 out:
-    if (vlc != NULL)
-        libvlc_release (vlc);
-
+    libvlc_release (vlc);
 #ifdef __OS2__
     for (int i = 2; i < argc; i++)
         free (argv[i]);
 #endif
-
-    return 0;
+    return ret;
 }



More information about the vlc-commits mailing list