X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=bacula%2Fsrc%2Fdird%2Fua_label.c;h=319a8e7a95abd0b1f03f952a8dc40fb83501e83c;hb=c5f4a68937116a768e6d85bc576a5fd41a56e93a;hp=0c5a7d0c088a2acbaf75458dd81e699262cf2707;hpb=cc99fdf148f7140766fcec1db3f90c223846c562;p=bacula%2Fbacula diff --git a/bacula/src/dird/ua_label.c b/bacula/src/dird/ua_label.c index 0c5a7d0c08..319a8e7a95 100644 --- a/bacula/src/dird/ua_label.c +++ b/bacula/src/dird/ua_label.c @@ -6,7 +6,7 @@ The main author of Bacula is Kern Sibbald, with contributions from many others, a complete list can be found in the file AUTHORS. This program is Free Software; you can redistribute it and/or - modify it under the terms of version two of the GNU General Public + modify it under the terms of version three of the GNU Affero General Public License as published by the Free Software Foundation and included in the file LICENSE. @@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - You should have received a copy of the GNU General Public License + You should have received a copy of the GNU Affero General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. @@ -84,6 +84,9 @@ static bool get_user_slot_list(UAContext *ua, char *slot_list, int num_slots) slot_list[i] = 0; } i = find_arg_with_value(ua, "slots"); + if (i == -1) { /* not found */ + i = find_arg_with_value(ua, "slot"); + } if (i > 0) { /* scan slot list in ua->argv[i] */ char *p, *e, *h; @@ -893,13 +896,28 @@ static vol_list_t *get_vol_list_from_SD(UAContext *ua, bool scan) vl->next = vol_list; vol_list = vl; } else { - /* Add new entry to end of list */ + vol_list_t *prev=vol_list; + /* Add new entry to the right place in the list */ for (vol_list_t *tvl=vol_list; tvl; tvl=tvl->next) { + if (tvl->Slot > vl->Slot) { + /* no previous item, update vol_list directly */ + if (prev == vol_list) { + vl->next = vol_list; + vol_list = vl; + + } else { /* replace the previous pointer */ + prev->next = vl; + vl->next = tvl; + } + break; + } + /* we are at the end */ if (!tvl->next) { tvl->next = vl; vl->next = NULL; break; } + prev = tvl; } } } @@ -1218,7 +1236,6 @@ void status_slots(UAContext *ua, STORE *store_r) } ua->send_msg(_(" Slot | Volume Name | Status | Media Type | Pool |\n")); ua->send_msg(_("------+------------------+-----------+----------------------+--------------------|\n")); - /* Walk through the list getting the media records */ for (vl=vol_list; vl; vl=vl->next) {