--- sal/osl/unx/file.cxx.ark	2006-04-30 15:16:06.000000000 +0200
+++ sal/osl/unx/file.cxx	2006-04-30 15:29:04.000000000 +0200
@@ -701,6 +701,7 @@ oslFileError osl_openFile( rtl_uString* 
             fd = open( buffer, flags, mode );
             if ( fd >= 0 )
             {
+		sal_Bool got_flock = sal_False;
 #ifndef HAVE_O_EXLOCK
                 /* check if file lock is enabled and clear l_type member of flock otherwise */
                 if( (char *) -1 == pFileLockEnvVar )
@@ -725,7 +726,18 @@ oslFileError osl_openFile( rtl_uString* 
                     aflock.l_type = 0;
 
                 /* lock the file if flock.l_type is set */
-                if( F_WRLCK != aflock.l_type || -1 != fcntl( fd, F_SETLK, &aflock ) )
+                if( F_WRLCK != aflock.l_type )
+			got_flock = sal_True;
+		if ( -1 != fcntl( fd, F_SETLK, &aflock ) )
+			got_flock = sal_True;
+		else if( errno == EAGAIN )
+			errno = EACCES; /* misleading synonym */
+		else if( errno == ENOLCK ) {
+			/* locking not supported */
+			errno = 0;
+			got_flock = sal_True;
+		}
+		if (got_flock)
                 {
                     /* allocate memory for impl structure */
                     pHandleImpl = (oslFileHandleImpl*) rtl_allocateMemory( sizeof(oslFileHandleImpl) );
