]> git.sesse.net Git - vlc/commitdiff
* ./src/interface/intf_eject.c: Fixed a MacOS X bug.
authorJon Lech Johansen <jlj@videolan.org>
Thu, 4 Apr 2002 00:23:36 +0000 (00:23 +0000)
committerJon Lech Johansen <jlj@videolan.org>
Thu, 4 Apr 2002 00:23:36 +0000 (00:23 +0000)
src/interface/intf_eject.c

index f9d1fb5f7f7c86041da3b90b829dd7502a546542..b50fd297ebdf1ef21b2dbb7abee5f1cba850ff73 100644 (file)
@@ -2,7 +2,7 @@
  * intf_eject.c: CD/DVD-ROM ejection handling functions
  *****************************************************************************
  * Copyright (C) 2001, 2002 VideoLAN
- * $Id: intf_eject.c,v 1.6 2002/04/03 23:24:42 massiot Exp $
+ * $Id: intf_eject.c,v 1.7 2002/04/04 00:23:36 jlj Exp $
  *
  * Author: Julien Blache <jb@technologeek.org> for the Linux part
  *               with code taken from the Linux "eject" command
@@ -107,14 +107,18 @@ int intf_Eject( const char *psz_device )
         if( ( p_eject = popen( sz_cmd, "r" ) ) != NULL )
         {
             char psz_result[0x200];
-            i_ret = fread( psz_result, 1, sizeof(psz_result), p_eject );
-            pclose( p_eject );
+            i_ret = fread( psz_result, 1, sizeof(psz_result) - 1, p_eject );
 
             if( i_ret == 0 && ferror( p_eject ) != 0 )
             {
+                pclose( p_eject );
                 return 1;
             }
 
+            pclose( p_eject );
+
+            psz_result[ i_ret ] = 0;
+
             if( strstr( psz_result, "Disk Ejected" ) != NULL )
             {
                 return 0;