int name_max;
char *mount_point;
VOLUME_CAT_INFO dcrVolCatInfo, devVolCatInfo;
+ char VolumeName[MAX_NAME_LENGTH];
struct stat statp;
bool found = false;
POOL_MEM fname(PM_FNAME);
bool need_slash = false;
int len;
-
+ dcrVolCatInfo = dcr->VolCatInfo; /* structure assignment */
+ devVolCatInfo = VolCatInfo; /* structure assignment */
+ bstrncpy(VolumeName, dcr->VolumeName, sizeof(VolumeName));
+
name_max = pathconf(".", _PC_NAME_MAX);
if (name_max < 1024) {
name_max = 1024;
* this volume is really OK. If not, put back the desired
* volume name, mark it not in changer and continue.
*/
- dcrVolCatInfo = dcr->VolCatInfo; /* structure assignment */
- devVolCatInfo = VolCatInfo; /* structure assignment */
/* Check if this is a valid Volume in the pool */
bstrncpy(dcr->VolumeName, result->d_name, sizeof(dcr->VolumeName));
if (!dir_get_volume_info(dcr, GET_VOL_INFO_FOR_WRITE)) {
closedir(dp);
get_out:
+ if (!found) {
+ /* Restore VolumeName we really wanted */
+ bstrncpy(dcr->VolumeName, VolumeName, sizeof(dcr->VolumeName));
+ dcr->VolCatInfo = dcrVolCatInfo; /* structure assignment */
+ VolCatInfo = devVolCatInfo; /* structure assignment */
+ }
sm_check(__FILE__, __LINE__, false);
return found;
}