if (QUERY_DB(jcr, mdb, mdb->cmd)) {
mdb->num_rows = sql_num_rows(mdb);
if (mdb->num_rows > 0) {
- Mmsg1(&mdb->errmsg, _("Media record %s already exists\n"), mr->VolumeName);
+ Mmsg1(&mdb->errmsg, _("Volume \"%s\" already exists\n."), mr->VolumeName);
sql_free_result(mdb);
db_unlock(mdb);
return 0;
{
int stat;
char ed1[50], ed2[50];
+ CLIENT_DBR tcr;
db_lock(mdb);
- if (!db_create_client_record(jcr, mdb, cr)) {
+ memcpy(&tcr, cr, sizeof(tcr));
+ if (!db_create_client_record(jcr, mdb, &tcr)) {
db_unlock(mdb);
return 0;
}
bstrncpy(mr->MediaType, jcr->store->media_type, sizeof(mr->MediaType));
bstrncpy(name, pr.LabelFormat, sizeof(name));
if (strchr(name, (int)'%') != NULL) {
- db_unlock(jcr->db);
Jmsg(jcr, M_ERROR, 0, _("Illegal character in Label Format\n"));
- return 0;
+ goto bail_out;
+ }
+ /* See if volume already exists */
+ mr->VolumeName[0] = 0;
+ for (int i=pr.NumVols+1; i<(int)pr.NumVols+11; i++) {
+ MEDIA_DBR tmr;
+ memset(&tmr, 0, sizeof(tmr));
+ sprintf(num, "%04d", i);
+ bstrncpy(tmr.VolumeName, name, sizeof(tmr.VolumeName));
+ bstrncat(tmr.VolumeName, num, sizeof(tmr.VolumeName));
+ if (db_get_media_record(jcr, jcr->db, &tmr)) {
+ Jmsg(jcr, M_WARNING, 0,
+_("Wanted to create Volume \"%s\", but it already exists. Trying again.\n"),
+ tmr.VolumeName);
+ continue;
+ }
+ bstrncpy(mr->VolumeName, tmr.VolumeName, sizeof(mr->VolumeName));
+ }
+ if (mr->VolumeName[0] == 0) {
+ Jmsg(jcr, M_ERROR, 0, _("Too many failures. Giving up creating Volume.\n"));
+ goto bail_out;
}
- sprintf(num, "%04d", ++pr.NumVols);
- bstrncpy(mr->VolumeName, name, sizeof(mr->VolumeName));
- bstrncat(mr->VolumeName, num, sizeof(mr->VolumeName));
+ pr.NumVols++;
if (db_create_media_record(jcr, jcr->db, mr) &&
db_update_pool_record(jcr, jcr->db, &pr)) {
db_unlock(jcr->db);
}
}
}
+bail_out:
db_unlock(jcr->db);
return 0;
}
msg_type = M_ERROR; /* Generate error message */
break;
case JS_Cancelled:
- term_msg = _("Verify Cancelled");
+ term_msg = _("Verify Canceled");
break;
case JS_Differences:
term_msg = _("Verify Differences");
* sha1.h
*
* Description:
- * This is the header file for code which implements the Secure
- * Hashing Algorithm 1 as defined in FIPS PUB 180-1 published
- * April 17, 1995.
+ * This is the header file for code which implements the Secure
+ * Hashing Algorithm 1 as defined in FIPS PUB 180-1 published
+ * April 17, 1995.
*
- * Many of the variable names in this code, especially the
- * single character names, were used because those were the names
- * used in the publication.
+ * Many of the variable names in this code, especially the
+ * single character names, were used because those were the names
+ * used in the publication.
*
- * Please read the file sha1.c for more information.
+ * Please read the file sha1.c for more information.
*
* Full Copyright Statement
*
/*
* If you do not have the ISO standard stdint.h header file, then you
* must typdef the following:
- * name meaning
- * uint32_t unsigned 32 bit integer
- * uint8_t unsigned 8 bit integer (i.e., unsigned char)
- * int_least16_t integer of >= 16 bits
+ * name meaning
+ * uint32_t unsigned 32 bit integer
+ * uint8_t unsigned 8 bit integer (i.e., unsigned char)
+ * int32_t integer of 32 bits
*
*/
enum
{
shaSuccess = 0,
- shaNull, /* Null pointer parameter */
- shaInputTooLong, /* input data too long */
- shaStateError /* called Input after Result */
+ shaNull, /* Null pointer parameter */
+ shaInputTooLong, /* input data too long */
+ shaStateError /* called Input after Result */
};
#endif
#define SHA1HashSize 20
{
uint32_t Intermediate_Hash[SHA1HashSize/4]; /* Message Digest */
- uint32_t Length_Low; /* Message length in bits */
- uint32_t Length_High; /* Message length in bits */
+ uint32_t Length_Low; /* Message length in bits */
+ uint32_t Length_High; /* Message length in bits */
- /* Index into message block array */
- int_least16_t Message_Block_Index;
- uint8_t Message_Block[64]; /* 512-bit message blocks */
+ /* Index into message block array */
+ int32_t Message_Block_Index;
+ uint8_t Message_Block[64]; /* 512-bit message blocks */
- int Computed; /* Is the digest computed? */
- int Corrupted; /* Is the message digest corrupted? */
+ int Computed; /* Is the digest computed? */
+ int Corrupted; /* Is the message digest corrupted? */
} SHA1Context;
/*
int SHA1Init(SHA1Context *);
int SHA1Update(SHA1Context *,
- const uint8_t *,
- unsigned int);
+ const uint8_t *,
+ unsigned int);
int SHA1Final(SHA1Context *,
- uint8_t Message_Digest[SHA1HashSize]);
+ uint8_t Message_Digest[SHA1HashSize]);
#endif
if (jcr->file_bsock) {
bnet_sig(jcr->file_bsock, BNET_TERMINATE);
}
+ /* If thread waiting on mount, wake him */
+ if (jcr->device && jcr->device->dev &&
+ (jcr->device->dev->dev_blocked == BST_WAITING_FOR_SYSOP ||
+ jcr->device->dev->dev_blocked == BST_UNMOUNTED ||
+ jcr->device->dev->dev_blocked == BST_UNMOUNTED_WAITING_FOR_SYSOP)) {
+ pthread_cond_signal(&jcr->device->dev->wait_next_vol);
+ }
bnet_fsend(dir, _("3000 Job %s marked to be cancelled.\n"), jcr->Job);
free_jcr(jcr);
}