--- ./dosemu-1.0.0/src/dosext/mfs/mfs.c	Sun Mar  5 13:57:37 2000
+++ ./dosemu-1.0.0-greg/src/dosext/mfs/mfs.c	Sat Jul 22 22:28:37 2000
@@ -3761,6 +3761,42 @@
 		ret = fcntl (fd,F_SETLK,&larg);
 		Debug0((dbg_fd, "lock fd=%x rc=%x type=%x whence=%x start=%lx, len=%lx\n",
 			fd, ret, larg.l_type, larg.l_whence, larg.l_start,larg.l_len));
+		/* This piece of code pretends to make file locking working
+		   on NetWare (Novell) shares, where the file is accessed by
+		   other clients also (on ONE linux box locking works locally without it)
+		   Thanks to Petr Vandrovec for explainations.
+		   Warning: You need to have 'Proprietary file locking' in ncpfs
+		            enabled. On NetWare (Novell) share program MUST lock and
+			    unlock exactly the same piece of file or else it will
+			    cause a memory leak in the kernel.
+		   If I could help You please write:
+		   Grzegorz Prokopski (prokopsk@novell.itn.pwr.wroc.pl)
+		*/
+#if 1
+		if (ret !=-1) { // linux (un)locking was sucessfull
+		    struct ncp_lock_ioctl ncplock;
+		    int err;
+		    ncplock.cmd = (larg.l_type==F_UNLCK) ? NCP_LOCK_CLEAR : NCP_LOCK_EX;
+		    ncplock.origin = 0;
+		    ncplock.offset = pt->offset;
+		    ncplock.length = pt->size;
+		    ncplock.timeout = 0;
+		    err = ioctl(fd, NCP_IOC_LOCKUNLOCK, &ncplock);
+		    Debug0((dbg_fd, "ncplock fd=%x result=%x cmd=%x origin=%x offset=%x size=%x timeout=%x\n",
+			fd, err, ncplock.cmd, ncplock.origin, ncplock.offset, ncplock.length, ncplock.timeout));
+		    if (err < 0) {
+			if (errno == EAGAIN) {
+			    if (larg.l_type!=F_UNLCK) {
+				larg.l_type=F_UNLCK;
+				fcntl (fd,F_SETLK,&larg);
+				ret = -1;
+			    };
+			} else if (errno == EINVAL) {
+			    Debug0((dbg_fd, "NCPLock failed - no ncplocking in kernel or file not on ncpfs\n"));
+			} else Debug0((dbg_fd, "NCPError: %s\n", strerror(errno))); 
+		    };    
+		};		
+#endif	
 		return ret != -1 ? TRUE : FALSE;
 	}
     break;
