case FT_SPEC:
case FT_REGE: /* empty file */
case FT_REG: /* regular file */
- if (exists) {
+ /*
+ * Note, we do not delete FT_RAW because these are device files
+ * or FIFOs that should already exist. If we blow it away,
+ * we may blow away a FIFO that is being used to read the
+ * restore data, or we may blow away a partition definition.
+ */
+ if (exists && attr->type != FT_RAW && attr->type != FT_FIFO) {
/* Get rid of old copy */
if (unlink(attr->ofname) == -1) {
berrno be;
}
Dmsg1(50, "Create file: %s\n", attr->ofname);
if (is_bopen(bfd)) {
- Jmsg1(jcr, M_ERROR, 0, "bpkt already open fid=%d\n", bfd->fid);
+ Jmsg1(jcr, M_ERROR, 0, _("bpkt already open fid=%d\n"), bfd->fid);
bclose(bfd);
}
/*
tid = NULL;
}
if (is_bopen(bfd)) {
- Jmsg1(jcr, M_ERROR, 0, "bpkt already open fid=%d\n", bfd->fid);
+ Jmsg1(jcr, M_ERROR, 0, _("bpkt already open fid=%d\n"), bfd->fid);
}
if ((bopen(bfd, attr->ofname, mode, 0)) < 0) {
berrno be;
*/
if (!is_portable_backup(bfd)) {
if (is_bopen(bfd)) {
- Jmsg1(jcr, M_ERROR, 0, "bpkt already open fid=%d\n", bfd->fid);
+ Jmsg1(jcr, M_ERROR, 0, _("bpkt already open fid=%d\n"), bfd->fid);
}
if ((bopen(bfd, attr->ofname, O_WRONLY|O_BINARY, 0)) < 0) {
berrno be;
*/
static int separate_path_and_file(JCR *jcr, char *fname, char *ofile)
{
- char *f, *p;
+ char *f, *p, *q;
int fnl, pnl;
/* Separate pathname and filename */
- for (p=f=ofile; *p; p++) {
+ for (q=p=f=ofile; *p; p++) {
if (*p == '/') {
- f = p; /* possible filename */
+ f = q; /* possible filename */
+ }
+#ifdef HAVE_WIN32
+ if (*p == '\\') { /* strip backslashes on Win32 */
+ continue;
}
+ *q++ = *p; /* copy data */
+#else
+ q++;
+#endif
}
+
if (*f == '/') {
f++;
}
+ *q = 0; /* terminate string */
- fnl = p - f;
+ fnl = q - f;
if (fnl == 0) {
/* The filename length must not be zero here because we
* are dealing with a file (i.e. FT_REGE or FT_REG).
if (jcr->cached_pnl == pnl && strcmp(path, jcr->cached_path) == 0) {
return 1;
}
- pm_strcpy(&jcr->cached_path, path);
+ pm_strcpy(jcr->cached_path, path);
jcr->cached_pnl = pnl;
return 0;
}