From: Kris Van Hees Date: Mon, 24 Jun 2002 20:09:59 +0000 (+0000) Subject: vol-allocate-partition-names-dynamically-to-avoid-problems-with-vx-stuff-20020624 X-Git-Tag: openafs-devel_1_3_3~87 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=78b1f7ec565ec32e114e80035581f95de50a9f04;p=packages%2Fo%2Fopenafs.git vol-allocate-partition-names-dynamically-to-avoid-problems-with-vx-stuff-20020624 otherwise long device paths can screw you --- diff --git a/src/vol/partition.c b/src/vol/partition.c index e36176157..4b2f6e118 100644 --- a/src/vol/partition.c +++ b/src/vol/partition.c @@ -190,9 +190,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"); @@ -201,7 +203,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; diff --git a/src/vol/partition.h b/src/vol/partition.h index c583bd0af..e471dea54 100644 --- a/src/vol/partition.h +++ b/src/vol/partition.h @@ -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 */