]> git.sesse.net Git - vlc/blobdiff - src/extras/libc.c
Replace vlc_bool_t by bool, VLC_TRUE by true and VLC_FALSE by false.
[vlc] / src / extras / libc.c
index 03321034bf8f5246834762400b27bdd9909325f2..8c5e3c20b0de3ed06a0478e7b8a11a413925f525 100644 (file)
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
 #include <vlc/vlc.h>
 
 #include <ctype.h>
 #   include <dirent.h>
 #endif
 
+#ifdef HAVE_SIGNAL_H
+#   include <signal.h>
+#endif
+
 #ifdef HAVE_FORK
 #   include <sys/time.h>
 #   include <unistd.h>
@@ -367,8 +375,7 @@ int64_t vlc_atoll( const char *nptr )
 /*****************************************************************************
  * lldiv: returns quotient and remainder
  *****************************************************************************/
-#if defined(SYS_BEOS) \
- || (defined (__FreeBSD__) && (__FreeBSD__ < 5))
+#if !defined( HAVE_LLDIV )
 lldiv_t vlc_lldiv( long long numer, long long denom )
 {
     lldiv_t d;
@@ -420,7 +427,7 @@ typedef struct vlc_DIR
     _WDIR *p_real_dir;
     int i_drives;
     struct _wdirent dd_dir;
-    vlc_bool_t b_insert_back;
+    bool b_insert_back;
 } vlc_DIR;
 
 void *vlc_wopendir( const wchar_t *wpath )
@@ -472,7 +479,7 @@ struct _wdirent *vlc_wreaddir( void *_p_dir )
             p_dir->dd_dir.d_reclen = 0;
             p_dir->dd_dir.d_namlen = 2;
             wcscpy( p_dir->dd_dir.d_name, L".." );
-            p_dir->b_insert_back = VLC_FALSE;
+            p_dir->b_insert_back = false;
             return &p_dir->dd_dir;
         }
 
@@ -740,10 +747,10 @@ int vlc_iconv_close( vlc_iconv_t cd )
  * reduce a fraction
  *   (adapted from libavcodec, author Michael Niedermayer <michaelni@gmx.at>)
  *****************************************************************************/
-vlc_bool_t vlc_ureduce( unsigned *pi_dst_nom, unsigned *pi_dst_den,
+bool vlc_ureduce( unsigned *pi_dst_nom, unsigned *pi_dst_den,
                         uint64_t i_nom, uint64_t i_den, uint64_t i_max )
 {
-    vlc_bool_t b_exact = 1;
+    bool b_exact = 1;
     uint64_t i_gcd;
 
     if( i_den == 0 )
@@ -953,6 +960,11 @@ int __vlc_execve( vlc_object_t *p_object, int i_argc, char *const *ppsz_argv,
             return -1;
 
         case 0:
+        {
+            sigset_t set;
+            sigemptyset (&set);
+            pthread_sigmask (SIG_SETMASK, &set, NULL);
+
             /* NOTE:
              * Like it or not, close can fail (and not only with EBADF)
              */
@@ -962,7 +974,8 @@ int __vlc_execve( vlc_object_t *p_object, int i_argc, char *const *ppsz_argv,
              && ((psz_cwd == NULL) || (chdir (psz_cwd) == 0)))
                 execve (ppsz_argv[0], ppsz_argv, ppsz_env);
 
-            exit (1);
+            exit (EXIT_FAILURE);
+        }
     }
 
     close (fds[1]);