Added full pathname lock patch from Andy <thwartedefforts@wonky.org>
authorJeremy Allison <jra@samba.org>
Wed, 6 Jan 1999 21:37:58 +0000 (21:37 +0000)
committerJeremy Allison <jra@samba.org>
Wed, 6 Jan 1999 21:37:58 +0000 (21:37 +0000)
Jeremy.

source/locking/locking_shm.c
source/locking/locking_slow.c

index 375a8b7f109edbc5df849eb42b0702ef39b9f889..8429ab8f7b1764c3d4b5c350a16d98093cc5380f 100644 (file)
@@ -430,7 +430,7 @@ static BOOL shm_set_share_mode(int token, files_struct *fsp, uint16 port, uint16
     /* We must create a share_mode_record */
     share_mode_record *new_mode_p = NULL;
     int new_offset = shmops->shm_alloc(sizeof(share_mode_record) +
-                                  strlen(fsp->fsp_name) + 1);
+                                  strlen(fsp->fsp_name) + strlen(fsp->conn->connectpath) + 2);
     if(new_offset == 0) {
            DEBUG(0,("ERROR:set_share_mode shmops->shm_alloc fail!\n"));
            return False;
@@ -441,7 +441,9 @@ static BOOL shm_set_share_mode(int token, files_struct *fsp, uint16 port, uint16
     new_mode_p->st_ino = inode;
     new_mode_p->num_share_mode_entries = 0;
     new_mode_p->share_mode_entries = 0;
-    pstrcpy(new_mode_p->file_name, fsp->fsp_name);
+    pstrcpy(new_mode_p->file_name, fsp->conn->connectpath);
+    pstrcat(new_mode_p->file_name, "/");
+    pstrcat(new_mode_p->file_name, fsp->fsp_name);
 
     /* Chain onto the start of the hash chain (in the hope we will be used first). */
     new_mode_p->next_offset = mode_array[hash_entry];
index 9f70f171b5ebb56c974da8a258d2027c9fb136b3..c91316d23d925a2b68be9c0b2d77e23d02581d98 100644 (file)
@@ -789,15 +789,17 @@ deleting it.\n", fname));
   {
     /* New file - just use a single_entry. */
     if((buf = (char *)malloc(SMF_HEADER_LENGTH + 
-                  strlen(fsp->fsp_name) + 1 + SMF_ENTRY_LENGTH)) == NULL)
+                  strlen(fsp->fsp_name) + strlen(fsp->conn->connectpath) + 2 + SMF_ENTRY_LENGTH)) == NULL)
     {
       DEBUG(0,("ERROR: set_share_mode: malloc failed for single entry.\n"));
       return False;
     }
     SIVAL(buf,SMF_VERSION_OFFSET,LOCKING_VERSION);
     SIVAL(buf,SMF_NUM_ENTRIES_OFFSET,0);
-    SSVAL(buf,SMF_FILENAME_LEN_OFFSET,strlen(fsp->fsp_name) + 1);
-    pstrcpy(buf + SMF_HEADER_LENGTH, fsp->fsp_name);
+    SSVAL(buf,SMF_FILENAME_LEN_OFFSET,strlen(fsp->fsp_name) + strlen(fsp->conn->connectpath) + 2);
+    pstrcpy(buf + SMF_HEADER_LENGTH, fsp->conn->connectpath);
+    pstrcat(buf + SMF_HEADER_LENGTH, "/");
+    pstrcat(buf + SMF_HEADER_LENGTH, fsp->fsp_name);
   }
 
   num_entries = IVAL(buf,SMF_NUM_ENTRIES_OFFSET);