- io.pkt_size = sizeof(io);
- io.pkt_end = sizeof(io);
- io.func = IO_OPEN;
- io.count = 0;
- io.buf = NULL;
- io.mode = 0777 & attr->statp.st_mode;
- io.flags = O_WRONLY;
- if (plug_func(plugin)->pluginIO(plugin_ctx, &io) != bRC_OK) {
+ 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 */
+ }
+ flags = O_WRONLY | O_CREAT | O_TRUNC | O_BINARY;
+ Dmsg0(dbglvl, "call bopen\n");
+ 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"),
+ attr->ofname, be.bstrerror());
+ Dmsg2(dbglvl,"Could not create %s: ERR=%s\n", attr->ofname, be.bstrerror());