Fixed oplock test path spec bug.
[samba.git] / source / smbd / oplock.c
index 19a3afa9981e8264eac1698b6bffa01b23bc6714..f61b025227f45d18b46c6e79cee4c7e79a2296a0 100644 (file)
@@ -1008,7 +1008,7 @@ BOOL attempt_close_oplocked_file(files_struct *fsp)
 
   DEBUG(5,("attempt_close_oplocked_file: checking file %s.\n", fsp->fsp_name));
 
-  if (fsp->open && fsp->granted_oplock && !fsp->sent_oplock_break) {
+  if (fsp->open && fsp->granted_oplock && !fsp->sent_oplock_break && (fsp->fd_ptr != NULL)) {
 
     /* Try and break the oplock. */
     file_fd_struct *fd_ptr = fsp->fd_ptr;
@@ -1048,7 +1048,7 @@ void check_kernel_oplocks(void)
     set_process_capability(KERNEL_OPLOCK_CAPABILITY,True);
     set_inherited_process_capability(KERNEL_OPLOCK_CAPABILITY,True);
 
-       slprintf(tmpname,sizeof(tmpname)-1, "%/koplock.%d", lp_lockdir(), (int)getpid());
+       slprintf(tmpname,sizeof(tmpname)-1, "%s/koplock.%d", lp_lockdir(), (int)getpid());
 
     if(pipe(pfd) != 0) {
       DEBUG(0,("check_kernel_oplocks: Unable to create pipe. Error was %s\n",
@@ -1056,7 +1056,7 @@ void check_kernel_oplocks(void)
       return;
     }
 
-    if((fd = open(tmpname, O_RDWR|O_CREAT|O_TRUNC|O_EXCL, 0600)) < 0) {
+    if((fd = sys_open(tmpname, O_RDWR|O_CREAT|O_TRUNC|O_EXCL, 0600)) < 0) {
       DEBUG(0,("check_kernel_oplocks: Unable to open temp test file %s. Error was %s\n",
             tmpname, strerror(errno) ));
       unlink( tmpname );