From: Andrew Deason Date: Tue, 11 Oct 2011 15:51:14 +0000 (-0500) Subject: volser: Remove ExtractVolId X-Git-Tag: openafs-stable-1_8_0pre1~3141 X-Git-Url: https://git.openafs.org/?p=openafs.git;a=commitdiff_plain;h=87f969f82d12c8200ede3fd30a151e09ab0bf6ad;hp=b5a153fb75bb6642490e9856dc6212244a590301 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 Reviewed-by: Jeffrey Altman Tested-by: BuildBot --- diff --git a/src/volser/volprocs.c b/src/volser/volprocs.c index e7f68eb..227a632 100644 --- a/src/volser/volprocs.c +++ b/src/volser/volprocs.c @@ -1924,22 +1924,6 @@ XVolListPartitions(struct rx_call *acid, struct partEntries *pEntries) } -/*extract the volume id from string vname. Its of the form " V0*.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 {