_GIT := $(shell eval $(topdir)/scripts/getgitcommit)
VERSIONGIT = "/git-$(_GIT)"
-UNITTESTSOBJ = $(LIBDIR)/unittests.lo
-LIBBACOBJ = $(LIBDIR)/libbac.la
LIBBACCFGOBJ = $(LIBDIR)/libbaccfg.la
PLUGINLIBSSRC = pluginlib.cpp pluginlib.h
tests: $(COMMONPLUGINTESTS)
-$(LIBBACCFGOBJ):
- $(MAKE) -C $(LIBDIR) libbaccfg.la
-
test_metaplugin_backend.lo: $(TESTMETAPLUGINBACKENDSRC)
@echo "Compiling backend $< ..."
$(NO_ECHO)$(LIBTOOL_COMPILE) $(CXX) $(DEFS) $(DEBUG) $(CPPFLAGS) $(CFLAGS) -I${SRCDIR} -I${FDDIR} -DLOGDIR=\"$(DESTDIR)$(working_dir)\" -c $<
int nlinks;
DMSG0(ctx, DDEBUG, "read_scan_stat_command()\n");
+
+ if (strncmp(cmd.c_str(), "STAT:/", 6) == 0)
+ {
+ DMSG0(ctx, DDEBUG, "read_scan_stat_command():new stat(2)\n");
+ POOL_MEM param(PM_FNAME);
+ // handle stat(2) for this file
+ scan_parameter_str(cmd, "STAT:", param);
+ int rc = stat(param.c_str(), &sp->statp);
+ if (rc < 0)
+ {
+ // error
+ DMSG1(ctx, DERROR, "Invalid path: %s\n", param.c_str());
+ return Invalid_Stat_Packet;
+ }
+ // stat is working as expected
+ DMSG1(ctx, DDEBUG, "read_scan_stat_command():stat: %o\n", sp->statp.st_mode & S_IFMT);
+ switch (sp->statp.st_mode & S_IFMT)
+ {
+ case S_IFDIR:
+ sp->type = FT_DIREND;
+ sp->link = sp->fname;
+ break;
+ case S_IFREG:
+ sp->type = FT_REG;
+ break;
+ default:
+ DMSG1(ctx, DERROR, "Unsupported file type: %o\n", sp->statp.st_mode & S_IFMT);
+ return Invalid_Stat_Packet;
+ }
+ return Status_Handled;
+ }
+
int32_t nfi = -1;
int nrscan = sscanf(cmd.c_str(), "STAT:%c %ld %d %d %o %d %d",
&type, &size, &uid, &gid, &perms, &nlinks, &nfi);
while (len < size) {
int32_t nbytes = 0;
int rc = ioctl(STDIN_FILENO, FIONREAD, &nbytes);
- snprintf(buflog, BUFLEN, ">> FIONREAD:%d:%ld", rc, nbytes);
+ snprintf(buflog, BUFLEN, ">> FIONREAD:%d:%ld", rc, (long int)nbytes);
LOG(buflog);
- if (nbytes < size){
+ if (size > (size_t)nbytes){
rc = ioctl(STDIN_FILENO, FIONREAD, &nbytes);
- snprintf(buflog, BUFLEN, ">> Second FIONREAD:%d:%ld", rc, nbytes);
+ snprintf(buflog, BUFLEN, ">> Second FIONREAD:%d:%ld", rc, (long int)nbytes);
LOG(buflog);
}
size_t bufread = size - len > BIGBUFLEN ? BIGBUFLEN : size - len;
signal_eod();
signal_eod();
+ // the file with external stat(2) packet
+ snprintf(buf, BIGBUFLEN, "FNAME:%s/java/%d/stat.file\n", PLUGINPREFIX, mypid);
+ write_plugin('C', buf);
+ write_plugin('C', "STAT:/etc/passwd\n");
+ write_plugin('I', "TEST18");
+ signal_eod();
+ // here comes a file data contents
+ write_plugin('C', "DATA\n");
+ write_plugin('D', "/* here comes a file data contents */");
+ write_plugin('D', "/* here comes another file line */");
+ write_plugin('D', "/* here comes another file line */");
+ write_plugin('D', "/* here comes another file line */");
+ write_plugin('D', "/* here comes another file line */");
+ signal_eod();
+ write_plugin('I', "TEST18Data");
+
// this plugin object should be the latest item to backup
if (regress_backup_plugin_objects)
{