* Authors: the Amanda Development Team. Its members are listed in a
* file named AUTHORS, in the root directory of this distribution.
*/
-/* $Id: taper.c,v 1.144 2006/08/24 11:23:32 martinea Exp $
+/* $Id: taper.c,v 1.144.2.7 2007/01/18 12:57:16 martinea Exp $
*
* moves files from holding disk to tape, or from a socket to tape
*/
/*NOTREACHED*/
}
- tapedev = stralloc(getconf_str(CNF_TAPEDEV));
+ tapedev = getconf_str(CNF_TAPEDEV);
tapetype = getconf_str(CNF_TAPETYPE);
tt = lookup_tapetype(tapetype);
#ifdef HAVE_LIBVTBLC
if ((buffers = attach_buffers(size)) != NULL) {
break;
}
- log_add(L_INFO, "attach_buffers: (%d tapebuf%s: %d bytes) %s",
+ log_add(L_INFO, "attach_buffers: (%d tapebuf%s: %zu bytes) %s",
conf_tapebufs,
(conf_tapebufs == 1) ? "" : "s",
size,
dbprintf(("create_split_buffer: fallback size " OFF_T_FMT "\n",
(OFF_T_FMT_TYPE)splitsize));
log_add(L_INFO,
- "%s: using fallback split size of %dkb to buffer %s in-memory",
- buff_err, splitsize, id_string);
+ "%s: using fallback split size of " OFF_T_FMT "kb to buffer %s in-memory",
+ buff_err, (OFF_T_FMT_TYPE)splitsize, id_string);
amfree(buff_err);
if (splitsize > mem_splitsize) {
amfree(mem_splitbuf);
if (mmap_splitbuffer_fd != -1) {
#ifdef HAVE_MMAP
#ifdef HAVE_SYS_MMAN_H
- if (splitbuf != NULL)
- munmap(splitbuf, (size_t)mmap_splitsize);
+ if (mmap_splitbuf != NULL) {
+ munmap(mmap_splitbuf, (size_t)mmap_splitsize);
+ mmap_splitbuf = NULL;
+ }
#endif
#endif
aclose(mmap_splitbuffer_fd);
mmap_splitsize = 0;
}
if (mem_splitbuf) {
- amfree(splitbuf);
+ amfree(mem_splitbuf);
mem_splitsize = 0;
}
}
taper_timestamp = newstralloc(taper_timestamp, cmdargs.argv[2]);
+ if (tapedev == NULL) {
+ if (getconf_str(CNF_TPCHANGER) == NULL) {
+ putresult(TAPE_ERROR, "[No tapedev or tpchanger defined]\n");
+ log_add(L_ERROR, "No tapedev or tpchanger defined");
+ dbprintf(("taper: No tapedev or tpchanger defined\n"));
+ exit(1);
+ }
+ } else {
+ tapedev = stralloc(tapedev);
+ }
+
tape_started = 0;
if (syncpipe_put('S', 0) == -1) {
put_syncpipe_fault_result(NULL);
}
file.blocksize = tt_blocksize;
build_header(bp->buffer, &file, tt_blocksize);
- kbytesread += (off_t)(tt_blocksize/1024); /* XXX shady */
file.type = F_CONT_DUMPFILE;
syncpipe_init(getp, putp);
tape_started = 0;
idlewait = times_zero;
+ if (tapedev != NULL) {
+ tapedev = stralloc(tapedev);
+ }
while (1) {
startclock();
}
if ((tape_fd = tape_open(tapedev, O_WRONLY)) == -1) {
if (errno == EACCES) {
- errstr = newstralloc(errstr,
- "writing label: tape is write protected");
+ errstr = newstralloc2(errstr,
+ "writing label: tape is write protected or I don't have write permission on ", tapedev);
} else {
errstr = newstralloc2(errstr,
"writing label: ", strerror(errno));