bpContext *plugin_ctx = (bpContext *)jcr->plugin_ctx;
Plugin *plugin = (Plugin *)jcr->plugin;
struct restore_pkt rp;
- mode_t mode;
+ int flags;
+ int rc;
if (!set_cmd_plugin(bfd, jcr)) {
return CF_ERROR;
rp.replace = jcr->replace;
rp.create_status = CF_ERROR;
Dmsg1(dbglvl, "call plugin createFile=%s\n", rp.ofname);
- if (plug_func(plugin)->createFile(plugin_ctx, &rp) != bRC_OK) {
+ rc = plug_func(plugin)->createFile(plugin_ctx, &rp);
+ if (rc != bRC_OK) {
+ Qmsg2(jcr, M_ERROR, 0, _("Plugin createFile call failed. Stat=%d file=%s\n"),
+ rc, attr->ofname);
return CF_ERROR;
}
- if (rp.create_status == CF_ERROR || rp.create_status == CF_CREATED) {
- return rp.create_status;
+ if (rp.create_status == CF_ERROR) {
+ Qmsg1(jcr, M_ERROR, 0, _("Plugin createFile call failed. Returned CF_ERROR file=%s\n"),
+ attr->ofname);
+ return CF_ERROR;
+ }
+ /* Created link or directory? */
+ if (rp.create_status == CF_CREATED) {
+ return rp.create_status; /* yes, no need to bopen */
}
- mode = O_WRONLY | O_CREAT | O_TRUNC | O_BINARY;
+ flags = O_WRONLY | O_CREAT | O_TRUNC | O_BINARY;
Dmsg0(dbglvl, "call bopen\n");
- if ((bopen(bfd, attr->ofname, mode, S_IRUSR | S_IWUSR)) < 0) {
+ if ((bopen(bfd, attr->ofname, flags, S_IRUSR | S_IWUSR)) < 0) {
berrno be;
be.set_errno(bfd->berrno);
Qmsg2(jcr, M_ERROR, 0, _("Could not create %s: ERR=%s\n"),
if (bfd->cmd_plugin && plugin_bopen) {
int rtnstat;
- Dmsg1(000, "call plugin_bopen fname=%s\n", fname);
+ Dmsg1(50, "call plugin_bopen fname=%s\n", fname);
rtnstat = plugin_bopen(bfd, fname, flags, mode);
if (rtnstat >= 0) {
if (flags & O_CREAT || flags & O_WRONLY) { /* Open existing for write */
+ Dmsg1(50, "plugin_open for write OK file=%s.\n", fname);
bfd->mode = BF_WRITE;
} else {
+ Dmsg1(50, "plugin_open for read OK file=%s.\n", fname);
bfd->mode = BF_READ;
}
} else {
bfd->mode = BF_CLOSED;
+ Dmsg1(000, "plugin_bopen returned bad status=%d\n", rtnstat);
}
free_pool_memory(win32_fname_wchar);
free_pool_memory(win32_fname);
*/
int create_file(JCR *jcr, ATTR *attr, BFILE *bfd, int replace)
{
- mode_t new_mode, parent_mode, mode;
+ mode_t new_mode, parent_mode;
+ int flags;
uid_t uid;
gid_t gid;
int pnl;
case FT_REGE:
case FT_REG:
Dmsg1(100, "Create=%s\n", attr->ofname);
- mode = O_WRONLY | O_CREAT | O_TRUNC | O_BINARY; /* O_NOFOLLOW; */
+ flags = O_WRONLY | O_CREAT | O_TRUNC | O_BINARY; /* O_NOFOLLOW; */
if (IS_CTG(attr->statp.st_mode)) {
- mode |= O_CTG; /* set contiguous bit if needed */
+ flags |= O_CTG; /* set contiguous bit if needed */
}
if (is_bopen(bfd)) {
Qmsg1(jcr, M_ERROR, 0, _("bpkt already open fid=%d\n"), bfd->fid);
}
- if ((bopen(bfd, attr->ofname, mode, S_IRUSR | S_IWUSR)) < 0) {
+ if ((bopen(bfd, attr->ofname, flags, S_IRUSR | S_IWUSR)) < 0) {
berrno be;
be.set_errno(bfd->berrno);
Qmsg2(jcr, M_ERROR, 0, _("Could not create %s: ERR=%s\n"),
if (attr->type == FT_RAW || attr->type == FT_FIFO) {
btimer_t *tid;
Dmsg1(400, "FT_RAW|FT_FIFO %s\n", attr->ofname);
- mode = O_WRONLY | O_BINARY;
+ flags = O_WRONLY | O_BINARY;
/* Timeout open() in 60 seconds */
if (attr->type == FT_FIFO) {
Dmsg0(400, "Set FIFO timer\n");
if (is_bopen(bfd)) {
Qmsg1(jcr, M_ERROR, 0, _("bpkt already open fid=%d\n"), bfd->fid);
}
- Dmsg2(400, "open %s mode=0x%x\n", attr->ofname, mode);
- if ((bopen(bfd, attr->ofname, mode, 0)) < 0) {
+ Dmsg2(400, "open %s flags=0x%x\n", attr->ofname, flags);
+ if ((bopen(bfd, attr->ofname, flags, 0)) < 0) {
berrno be;
be.set_errno(bfd->berrno);
Qmsg2(jcr, M_ERROR, 0, _("Could not open %s: ERR=%s\n"),
#undef VERSION
#define VERSION "2.5.10"
-#define BDATE "03 October 2008"
-#define LSMDATE "03Oct08"
+#define BDATE "04 October 2008"
+#define LSMDATE "04Oct08"
#define PROG_COPYRIGHT "Copyright (C) %d-2008 Free Software Foundation Europe e.V.\n"
#define BYEAR "2008" /* year for copyright messages in progs */
remove reader/writer in FOPTS????
General:
+04Oct08
+kes Add more plugin restore debug code.
03Oct08
kes Fix plugin_bwrite - plugin-blseek mixup pointed out by James.
kes Rewrite plugin restore interface a bit to correspond to how Bacula