From 080e4a736ba95d4dcb4167a1a8f8accab8a928b0 Mon Sep 17 00:00:00 2001 From: Andrew Deason Date: Tue, 11 Oct 2011 10:51:14 -0500 Subject: [PATCH] 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. Reviewed-on: http://gerrit.openafs.org/5594 Reviewed-by: Derrick Brashear Reviewed-by: Jeffrey Altman Tested-by: BuildBot (cherry picked from commit 87f969f82d12c8200ede3fd30a151e09ab0bf6ad) Change-Id: I4f047c4141493e151db0a6b5ec21bee3af35e040 Reviewed-on: http://gerrit.openafs.org/5720 Reviewed-by: Derrick Brashear Tested-by: Derrick Brashear --- src/volser/volprocs.c | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/src/volser/volprocs.c b/src/volser/volprocs.c index 881ecbd60..13ad8dc3c 100644 --- a/src/volser/volprocs.c +++ b/src/volser/volprocs.c @@ -1898,22 +1898,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 @@ -1924,7 +1908,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 { -- 2.39.5