/*
Bacula® - The Network Backup Solution
- Copyright (C) 2007-2008 Free Software Foundation Europe e.V.
+ Copyright (C) 2007-2010 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.
static const int dbglvl = 150;
-#define PLUGIN_LICENSE "GPLv2"
+#define PLUGIN_LICENSE "Bacula GPLv2"
#define PLUGIN_AUTHOR "Kern Sibbald"
#define PLUGIN_DATE "January 2008"
#define PLUGIN_VERSION "1"
static bRC freePlugin(bpContext *ctx)
{
struct plugin_ctx *p_ctx = (struct plugin_ctx *)ctx->pContext;
+ if (!p_ctx) {
+ return bRC_Error;
+ }
if (p_ctx->cmd) {
free(p_ctx->cmd); /* free any allocated command string */
}
static bRC handlePluginEvent(bpContext *ctx, bEvent *event, void *value)
{
struct plugin_ctx *p_ctx = (struct plugin_ctx *)ctx->pContext;
+ if (!p_ctx) {
+ return bRC_Error;
+ }
+
// char *name;
/*
* what is really going on.
*/
switch (event->eventType) {
+ case bEventPluginCommand:
+ bfuncs->DebugMessage(ctx, fi, li, dbglvl,
+ "bpipe-fd: PluginCommand=%s\n", (char *)value);
+ break;
case bEventJobStart:
bfuncs->DebugMessage(ctx, fi, li, dbglvl, "bpipe-fd: JobStart=%s\n", (char *)value);
break;
*p++ = 0; /* terminate reader string */
p_ctx->writer = p;
// printf("bpipe-fd: plugin=%s fname=%s reader=%s writer=%s\n",
- p_ctx->cmd, p_ctx->fname, p_ctx->reader, p_ctx->writer);
+// p_ctx->cmd, p_ctx->fname, p_ctx->reader, p_ctx->writer);
break;
default:
// printf("bpipe-fd: unknown event=%d\n", event->eventType);
+ break;
}
return bRC_OK;
}
static bRC startBackupFile(bpContext *ctx, struct save_pkt *sp)
{
struct plugin_ctx *p_ctx = (struct plugin_ctx *)ctx->pContext;
+ if (!p_ctx) {
+ return bRC_Error;
+ }
time_t now = time(NULL);
sp->fname = p_ctx->fname;
sp->type = FT_REG;
static bRC pluginIO(bpContext *ctx, struct io_pkt *io)
{
struct plugin_ctx *p_ctx = (struct plugin_ctx *)ctx->pContext;
+ if (!p_ctx) {
+ return bRC_Error;
+ }
io->status = 0;
io->io_errno = 0;