mirror of
https://git.openafs.org/openafs.git
synced 2025-01-22 17:00:15 +00:00
volser: Remove ExtractVolId
volser was using its own function to extract a volume ID from a filename string, and was using atol to do so. The ato* family of functions can have problems with larger volume IDs, not to mention a lack of error checking, so don't use it. Since we already have the function VolumeNumber in the vol package to do the very same thing, just use that instead. Change-Id: I40953d3533454503583685eb3adeb0079137c8a1 Reviewed-on: http://gerrit.openafs.org/5594 Reviewed-by: Derrick Brashear <shadow@dementix.org> Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com> Tested-by: BuildBot <buildbot@rampaginggeek.com>
This commit is contained in:
parent
b5a153fb75
commit
87f969f82d
@ -1924,22 +1924,6 @@ XVolListPartitions(struct rx_call *acid, struct partEntries *pEntries)
|
||||
|
||||
}
|
||||
|
||||
/*extract the volume id from string vname. Its of the form " V0*<id>.vol "*/
|
||||
afs_int32
|
||||
ExtractVolId(char vname[])
|
||||
{
|
||||
int i;
|
||||
char name[VOLSER_MAXVOLNAME + 1];
|
||||
|
||||
strcpy(name, vname);
|
||||
i = 0;
|
||||
while (name[i] == 'V' || name[i] == '0')
|
||||
i++;
|
||||
|
||||
name[11] = '\0'; /* smash the "." */
|
||||
return (atol(&name[i]));
|
||||
}
|
||||
|
||||
/*return the name of the next volume header in the directory associated with dirp and dp.
|
||||
*the volume id is returned in volid, and volume header name is returned in volname*/
|
||||
int
|
||||
@ -1950,7 +1934,7 @@ GetNextVol(DIR * dirp, char *volname, afs_uint32 * volid)
|
||||
dp = readdir(dirp); /*read next entry in the directory */
|
||||
if (dp) {
|
||||
if ((dp->d_name[0] == 'V') && !strcmp(&(dp->d_name[11]), VHDREXT)) {
|
||||
*volid = ExtractVolId(dp->d_name);
|
||||
*volid = VolumeNumber(dp->d_name);
|
||||
strcpy(volname, dp->d_name);
|
||||
return 0; /*return the name of the file representing a volume */
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user