}
if ((errstat=rwl_init(&mdb->lock)) != 0) {
+ berrno be;
Mmsg1(&mdb->errmsg, _("Unable to initialize DB lock. ERR=%s\n"),
- strerror(errstat));
+ be.bstrerror(errstat));
V(mutex);
return 0;
}
mdb->connected = FALSE;
if ((errstat=rwl_init(&mdb->lock)) != 0) {
+ berrno be;
Mmsg1(&mdb->errmsg, _("Unable to initialize DB lock. ERR=%s\n"),
- strerror(errstat));
+ be.bstrerror(errstat));
V(mutex);
return 0;
}
}
fd = fopen(argk[1], "rb");
if (!fd) {
+ berrno be;
senditf(_("Cannot open file %s for input. ERR=%s\n"),
- argk[1], strerror(errno));
+ argk[1], be.bstrerror());
return 1;
}
read_and_process_input(fd, UA_sock);
goto bail_out;
}
if ((fd=fopen(query_file, "rb")) == NULL) {
+ berrno be;
ua->error_msg(_("Could not open %s: ERR=%s\n"), query_file,
- strerror(errno));
+ be.bstrerror());
goto bail_out;
}
jcr->RestoreBootstrap = bstrdup(ua->cmd);
fd = fopen(jcr->RestoreBootstrap, "rb");
if (!fd) {
+ berrno be;
ua->send_msg(_("Warning cannot open %s: ERR=%s\n"),
- jcr->RestoreBootstrap, strerror(errno));
+ jcr->RestoreBootstrap, be.bstrerror());
free(jcr->RestoreBootstrap);
jcr->RestoreBootstrap = NULL;
} else {
dev->VolCatInfo.VolCatName,
dev->file, dev->block_num, dev->print_name(), wlen, stat);
}
- Dmsg7(100, "=== Write error. fd=%d size=%u rtn=%d dev_blk=%d blk_blk=%d errno=%d: ERR=%s\n",
- dev->fd(), wlen, stat, dev->block_num, block->BlockNumber,
- dev->dev_errno, strerror(dev->dev_errno));
+ if (debug_level >= 100) {
+ berrno be;
+ Dmsg7(100, "=== Write error. fd=%d size=%u rtn=%d dev_blk=%d blk_blk=%d errno=%d: ERR=%s\n",
+ dev->fd(), wlen, stat, dev->block_num, block->BlockNumber,
+ dev->dev_errno, be.bstrerror(dev->dev_errno));
+ }
ok = terminate_writing_volume(dcr);
if (!ok && !forge_on) {
/* This may not be fatal since we already wrote an EOF */
Jmsg(dcr->jcr, M_ERROR, 0, "%s", dev->errmsg);
}
+
bail_out:
dev->set_ateot(); /* no more writing this tape */
- Dmsg1(100, "Leave terminate_writing_volume -- %s\n", ok?"OK":"ERROR");
+ Dmsg1(50, "*** Leave terminate_writing_volume -- %s\n", ok?"OK":"ERROR");
return ok;
}
-/*
- *
- * Dumb program to do an "ls" of a Bacula 1.0 mortal file.
- *
- * Kern Sibbald, MM
- *
- * Version $Id$
- */
/*
Bacula® - The Network Backup Solution
- Copyright (C) 2000-2006 Free Software Foundation Europe e.V.
+ Copyright (C) 2000-2007 Free Software Foundation Europe e.V.
The main author of Bacula is Kern Sibbald, with contributions from
many others, a complete list can be found in the file AUTHORS.
(FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
Switzerland, email:ftf@fsfeurope.org.
*/
+/*
+ *
+ * Dumb program to do an "ls" of a Bacula 1.0 mortal file.
+ *
+ * Kern Sibbald, MM
+ *
+ * Version $Id$
+ */
#include "bacula.h"
#include "stored.h"
case 'e': /* exclude list */
if ((fd = fopen(optarg, "rb")) == NULL) {
+ berrno be;
Pmsg2(0, _("Could not open exclude file: %s, ERR=%s\n"),
- optarg, strerror(errno));
+ optarg, be.bstrerror());
exit(1);
}
while (fgets(line, sizeof(line), fd) != NULL) {
case 'i': /* include list */
if ((fd = fopen(optarg, "rb")) == NULL) {
+ berrno be;
Pmsg2(0, _("Could not open include file: %s, ERR=%s\n"),
- optarg, strerror(errno));
+ optarg, be.bstrerror());
exit(1);
}
while (fgets(line, sizeof(line), fd) != NULL) {
char buf1[100], buf2[100];
for ( ;; ) {
if (!read_block_from_device(dcr, NO_BLOCK_NUMBER_CHECK)) {
- Dmsg1(100, "!read_block(): ERR=%s\n", dev->strerror());
+ Dmsg1(100, "!read_block(): ERR=%s\n", dev->bstrerror());
if (dev->at_eot()) {
if (!mount_next_read_volume(dcr)) {
Jmsg(jcr, M_INFO, 0, _("Got EOM at file %u on device %s, Volume \"%s\"\n"),
/* Initialize FD start condition variable */
int errstat = pthread_cond_init(&jcr->job_start_wait, NULL);
if (errstat != 0) {
- Jmsg1(jcr, M_FATAL, 0, _("Unable to init job cond variable: ERR=%s\n"), strerror(errstat));
+ berrno be;
+ Jmsg1(jcr, M_FATAL, 0, _("Unable to init job cond variable: ERR=%s\n"), be.bstrerror(errstat));
goto bail_out;
}
bstrncpy(dcr->VolCatInfo.VolCatName, volname, sizeof(dcr->VolCatInfo.VolCatName));
if (dev->open(dcr, mode) < 0) {
dir->fsend(_("3910 Unable to open device %s: ERR=%s\n"),
- dev->print_name(), dev->strerror());
+ dev->print_name(), dev->bstrerror());
goto bail_out;
}
jcr->RestoreBootstrap = fname;
bs = fopen(fname, "a+b"); /* create file */
if (!bs) {
+ berrno be;
Jmsg(jcr, M_FATAL, 0, _("Could not create bootstrap file %s: ERR=%s\n"),
- jcr->RestoreBootstrap, strerror(errno));
+ jcr->RestoreBootstrap, be.bstrerror());
goto bail_out;
}
Dmsg0(10, "=== Bootstrap file ===\n");
Dmsg0(150, "Cannot write session label to block.\n");
if (!write_block_to_device(dcr)) {
Dmsg0(130, "Got session label write_block_to_dev error.\n");
- /* ****FIXME***** errno is not set here */
- Jmsg(jcr, M_FATAL, 0, _("Error writing Session label to %s: %s\n"),
- dev_vol_name(dev), strerror(errno));
free_record(rec);
return false;
}
}
if (!write_record_to_block(block, rec)) {
- Jmsg(jcr, M_FATAL, 0, _("Error writing Session label to %s: %s\n"),
- dev_vol_name(dev), strerror(errno));
free_record(rec);
return false;
}
* DEVICE::dlock() does P(m_mutex) (in dev.h)
* DEVICE::dunlock() does V(m_mutex)
*
- * DEVICE::r_dlock() does recursive locking
+ * DEVICE::r_dlock() allows locking the device when this thread
+ already has the device blocked.
* dlock()
* if blocked and not same thread that locked
* pthread_cond_wait
* leaves device locked
*
- * DEVICE::r_dunlock()
+ * DEVICE::r_dunlock() unlocks but does not unblock
* same as dunlock();
*
* DEVICE::dblock(why) does
*/
create_volume_list(); /* do before device_init */
if (pthread_create(&thid, NULL, device_initialization, NULL) != 0) {
- Emsg1(M_ABORT, 0, _("Unable to create thread. ERR=%s\n"), strerror(errno));
+ berrno be;
+ Emsg1(M_ABORT, 0, _("Unable to create thread. ERR=%s\n"), be.bstrerror());
}
start_watchdog(); /* start watchdog thread */
/* Initialize FD start condition variable */
int errstat = pthread_cond_init(&jcr->job_start_wait, NULL);
if (errstat != 0) {
- Jmsg1(jcr, M_ABORT, 0, _("Unable to init job cond variable: ERR=%s\n"), strerror(errstat));
+ berrno be;
+ Jmsg1(jcr, M_ABORT, 0, _("Unable to init job cond variable: ERR=%s\n"), be.bstrerror(errstat));
}
foreach_res(device, R_DEVICE) {
General:
28Sep07
+kes Eliminate more strerror() and replace with bstrerror().
kes Remove BSD getopt and replace with unrestricted IBM version
kes Fix Win32 build.
kes More tweaks to the mount volume routines to get everything