Skip to content

Commit

Permalink
Don't return empty volname if volume is on unwanted vols list
Browse files Browse the repository at this point in the history
When the volume was on the unwanted_list, the loop was
continued but the number of sql rows was not checked, so that
the code continued and returned an empty volumename.

Fixes #691: Backup job fails with "No Volume name given."
  • Loading branch information
pstorz authored and joergsteffens committed Jun 8, 2017
1 parent 3d0a1a0 commit d1ff29b
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/cats/sql_find.c
Expand Up @@ -435,9 +435,18 @@ int db_find_next_volume(JCR *jcr, B_DB *mdb, int item, bool InChanger, MEDIA_DBR
}

/*
* See if this is not on the unwanted volumes list.
* Skip if volume is on unwanted volumes list.
* We need to reduce the number of rows by one
* and jump out if no more rows are available
*/
if (unwanted_volumes && is_on_unwanted_volumes_list(row[1], unwanted_volumes)) {
Dmsg1(50, "Volume %s is on unwanted_volume_list, skipping\n", row[1]);
num_rows-- ;
if ( num_rows <= 0) {
Dmsg1(50, "No more volumes in result, bailing out\n", row[1]);
sql_free_result(mdb);
goto bail_out;
}
continue;
}

Expand Down

0 comments on commit d1ff29b

Please sign in to comment.