mirror of
https://git.openafs.org/openafs.git
synced 2025-01-21 00:10:15 +00:00
Windows: remove faulty assumptions about device names in vol-salvage
The implementation has an assumption that all disk volumes have an object name of \Device\HarddiskXXX (where XXX is a number). This is wrong since the name is purely a convention and since about WXP they have been called \Device\HarddiskVolumeXXX. Either way it is spurious to assume the format and then try to compare the XXX. This change just compares the strings. This is done in a case insenstive manner which is the safer option. It is quite feasible, but very unlikely that someone will uses 'case sensitively different' object names. Change-Id: Ifa91c88f2b17f747f30541b8833b722cf5993e48 Reviewed-on: http://gerrit.openafs.org/3745 Tested-by: BuildBot <buildbot@rampaginggeek.com> Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
This commit is contained in:
parent
f60bca943f
commit
ffb0cdcc91
@ -469,35 +469,31 @@ int
|
||||
SameDisk(struct DiskPartition64 *p1, struct DiskPartition64 *p2)
|
||||
{
|
||||
#define RES_LEN 256
|
||||
char res[RES_LEN];
|
||||
int d1, d2;
|
||||
char res1[RES_LEN];
|
||||
char res2[RES_LEN];
|
||||
|
||||
static int dowarn = 1;
|
||||
|
||||
if (!QueryDosDevice(p1->devName, res, RES_LEN - 1))
|
||||
if (!QueryDosDevice(p1->devName, res1, RES_LEN - 1))
|
||||
return 1;
|
||||
if (strncmp(res, HDSTR, HDLEN)) {
|
||||
if (strncmp(res1, HDSTR, HDLEN)) {
|
||||
if (dowarn) {
|
||||
dowarn = 0;
|
||||
Log("WARNING: QueryDosDevice is returning %s, not %s for %s\n",
|
||||
res, HDSTR, p1->devName);
|
||||
res1, HDSTR, p1->devName);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
d1 = atoi(&res[HDLEN]);
|
||||
|
||||
if (!QueryDosDevice(p2->devName, res, RES_LEN - 1))
|
||||
if (!QueryDosDevice(p2->devName, res2, RES_LEN - 1))
|
||||
return 1;
|
||||
if (strncmp(res, HDSTR, HDLEN)) {
|
||||
if (strncmp(res2, HDSTR, HDLEN)) {
|
||||
if (dowarn) {
|
||||
dowarn = 0;
|
||||
Log("WARNING: QueryDosDevice is returning %s, not %s for %s\n",
|
||||
res, HDSTR, p2->devName);
|
||||
res2, HDSTR, p2->devName);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
d2 = atoi(&res[HDLEN]);
|
||||
|
||||
return d1 == d2;
|
||||
return (0 == _strnicmp(res1, res2, RES_LEN - 1));
|
||||
}
|
||||
#else
|
||||
#define SameDisk(P1, P2) ((P1)->device/PartsPerDisk == (P2)->device/PartsPerDisk)
|
||||
|
Loading…
Reference in New Issue
Block a user