diff -ru libdvdread-0.9.4/dvdread/bswap.h libdvdread/dvdread/bswap.h
--- libdvdread-0.9.4/dvdread/bswap.h	2002-12-15 01:09:12.000000000 +0100
+++ libdvdread/dvdread/bswap.h	2005-08-31 19:24:57.000000000 +0200
@@ -65,7 +65,7 @@
  * functionality! 
  */
 
-#elif defined(__FreeBSD__) || defined(__sun) || defined(__bsdi__) || defined(WIN32)
+#elif defined(__FreeBSD__) || defined(__sun) || defined(__bsdi__) || defined(WIN32) || defined( __BEOS__ )
 #define B2N_16(x) \
  x = ((((x) & 0xff00) >> 8) | \
       (((x) & 0x00ff) << 8))
diff -ru libdvdread-0.9.4/dvdread/dvd_reader.c libdvdread/dvdread/dvd_reader.c
--- libdvdread-0.9.4/dvdread/dvd_reader.c	2003-02-13 23:31:21.000000000 +0100
+++ libdvdread/dvdread/dvd_reader.c	2005-08-31 19:24:57.000000000 +0200
@@ -324,8 +324,7 @@
     else
 #endif
     {
-        ret = stat( path, &fileinfo );
-        if( ret < 0 ) {
+        if( *path && (ret = stat( path, &fileinfo ) < 0) ) {
 	    /* If we can't stat the file, give up */
 	    fprintf( stderr, "libdvdread: Can't stat %s\n", path );
 	    perror("");
@@ -315,7 +314,7 @@
     have_css = dvdinput_setup();
 
     /* First check if this is a block/char device or a file*/
-    if( S_ISBLK( fileinfo.st_mode ) || 
+    if( !*path || S_ISBLK( fileinfo.st_mode ) || 
 	S_ISCHR( fileinfo.st_mode ) || 
 	S_ISREG( fileinfo.st_mode ) ) {
 
@@ -344,14 +343,16 @@
 
 	/* Resolve any symlinks and get the absolut dir name. */
 	{
+	    char *current_path;
 	    char *new_path;
-	    int cdir = open( ".", O_RDONLY );
-	    
-	    if( cdir >= 0 ) {
+
+	    current_path = getcwd( NULL, PATH_MAX );
+	    if( current_path ) {
 		chdir( path_copy );
 		new_path = getcwd( NULL, PATH_MAX );
-		fchdir( cdir );
-		close( cdir );
+		chdir( current_path );
+		free( current_path );
+
 		if( new_path ) {
 		    free( path_copy );
 		    path_copy = new_path;
@@ -504,10 +505,12 @@
             sprintf( filename, "%s%s%s", path,
                      ( ( path[ strlen( path ) - 1 ] == '/' ) ? "" : "/" ),
                      ent->d_name );
+            closedir( dir );
             return 0;
         }
     }
 
+    closedir( dir );
     return -1;
 }
 
