]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
STABLE12-vol-allocate-partition-names-dynamically-to-avoid-problems-with-vx-stuff...
authorKris Van Hees <aedil@sinenomine.net>
Wed, 10 Jul 2002 21:41:45 +0000 (21:41 +0000)
committerDerrick Brashear <shadow@dementia.org>
Wed, 10 Jul 2002 21:41:45 +0000 (21:41 +0000)
otherwise long device paths can screw you

(cherry picked from commit 78b1f7ec565ec32e114e80035581f95de50a9f04)

src/vol/partition.c
src/vol/partition.h

index fcdafbe9a44d0f982dbb33e2b8e64e1f82480fee..2a63e32cd774e0f4e5b4d85efb07139f44dc5ec4 100644 (file)
@@ -194,9 +194,11 @@ static void VInitPartition_r(char *path, char *devname, Device dev)
     else
        DiskPartitionList = dp;
     dp->next = 0;
-    strcpy(dp->name, path);
+    dp->name = (char *)malloc(strlen(path) + 1);
+    strncpy(dp->name, path, strlen(path) + 1);
 #if defined(AFS_NAMEI_ENV) && !defined(AFS_NT40_ENV)
     /* Create a lockfile for the partition, of the form /vicepa/Lock/vicepa */
+    dp->devName = (char *)malloc(2 * strlen(path) + 6);
     strcpy(dp->devName, path);
     strcat(dp->devName, "/");
     strcat(dp->devName, "Lock");
@@ -205,7 +207,8 @@ static void VInitPartition_r(char *path, char *devname, Device dev)
     close(open(dp->devName, O_RDWR | O_CREAT, 0600));
     dp->device = volutil_GetPartitionID(path);
 #else
-    strcpy(dp->devName, devname);
+    dp->devName = (char *)malloc(strlen(devname) + 1);
+    strncpy(dp->devName, devname, strlen(devname) + 1);
     dp->device = dev;
 #endif
     dp->lock_fd = -1;
index c583bd0af61fc8c901b306d29e916ece93735232..e471dea5474693f16bb1183f7a72f1ef8c0b38ce 100644 (file)
@@ -50,8 +50,8 @@
  */
 struct DiskPartition {
     struct DiskPartition *next;
-    char       name[32];       /* Mounted partition name */
-    char       devName[32];    /* Device mounted on */
+    char       *name;          /* Mounted partition name */
+    char       *devName;       /* Device mounted on */
     Device     device;         /* device number */
     int                lock_fd;        /* File descriptor of this partition if locked; otherwise -1;
                                   Not used by the file server */