/* Copy to first path separator -- Win32 might have c: ... */
while (*in && !IsPathSeparator(*in)) {
- *out++ = *in++;
+ out++; in++;
}
- *out++ = *in++;
+ out++; in++;
numsep++; /* one separator seen */
for (stripped=0; stripped<count && *in; stripped++) {
while (*in && !IsPathSeparator(*in)) {
ff_pkt->link_save = get_pool_memory(PM_FNAME);
}
pm_strcpy(ff_pkt->fname_save, ff_pkt->fname);
+ if (ff_pkt->type != FT_LNK && ff_pkt->fname != ff_pkt->link) {
+ pm_strcpy(ff_pkt->link_save, ff_pkt->link);
+ Dmsg2(500, "strcpy link_save=%d link=%d\n", strlen(ff_pkt->link_save),
+ strlen(ff_pkt->link));
+ sm_check(__FILE__, __LINE__, true);
+ }
/*
* Strip path. If it doesn't succeed put it back. If
* Do not strip symlinks.
* I.e. if either stripping fails don't strip anything.
*/
- if (do_strip(ff_pkt->strip_path, ff_pkt->fname)) {
- /* Strip links but not symlinks */
- if (ff_pkt->type != FT_LNK && ff_pkt->fname != ff_pkt->link) {
- pm_strcpy(ff_pkt->link_save, ff_pkt->link);
- if (!do_strip(ff_pkt->strip_path, ff_pkt->link)) {
- strcpy(ff_pkt->link, ff_pkt->link_save);
- strcpy(ff_pkt->fname, ff_pkt->fname_save);
- }
- }
- } else {
- strcpy(ff_pkt->fname, ff_pkt->fname_save);
+ if (!do_strip(ff_pkt->strip_path, ff_pkt->fname)) {
+ unstrip_path(ff_pkt);
+ goto rtn;
}
- Dmsg2(200, "fname=%s stripped=%s\n", ff_pkt->fname_save, ff_pkt->fname);
+ /* Strip links but not symlinks */
+ if (ff_pkt->type != FT_LNK && ff_pkt->fname != ff_pkt->link) {
+ if (!do_strip(ff_pkt->strip_path, ff_pkt->link)) {
+ unstrip_path(ff_pkt);
+ }
+ }
+
+rtn:
+ Dmsg3(100, "fname=%s stripped=%s link=%s\n", ff_pkt->fname_save, ff_pkt->fname,
+ ff_pkt->link);
}
void unstrip_path(FF_PKT *ff_pkt)
}
strcpy(ff_pkt->fname, ff_pkt->fname_save);
if (ff_pkt->type != FT_LNK && ff_pkt->fname != ff_pkt->link) {
+ Dmsg2(500, "strcpy link=%s link_save=%s\n", ff_pkt->link,
+ ff_pkt->link_save);
strcpy(ff_pkt->link, ff_pkt->link_save);
+ Dmsg2(500, "strcpy link=%d link_save=%d\n", strlen(ff_pkt->link),
+ strlen(ff_pkt->link_save));
+ sm_check(__FILE__, __LINE__, true);
}
}
#include "bacula.h"
#include "find.h"
+const int dbglvl = 200;
+
int (*plugin_bopen)(JCR *jcr, const char *fname, int flags, mode_t mode) = NULL;
int (*plugin_bclose)(JCR *jcr) = NULL;
ssize_t (*plugin_bread)(JCR *jcr, void *buf, size_t count) = NULL;
}
/* Normal file open */
- Dmsg1(100, "open file %s\n", fname);
+ Dmsg1(dbglvl, "open file %s\n", fname);
/* We use fnctl to set O_NOATIME if requested to avoid open error */
bfd->fid = open(fname, flags & ~O_NOATIME, mode);
*/
if (ff_pkt->incremental &&
(ff_pkt->statp.st_mtime < ff_pkt->save_time &&
- ((ff_pkt->flags & FO_MTIMEONLY) ||
- ff_pkt->statp.st_ctime < ff_pkt->save_time)))
+ ((ff_pkt->flags & FO_MTIMEONLY) ||
+ ff_pkt->statp.st_ctime < ff_pkt->save_time)))
{
return false;
}
lp->ino = ff_pkt->statp.st_ino;
lp->dev = ff_pkt->statp.st_dev;
bstrncpy(lp->name, fname, len);
- lp->next = ff_pkt->linkhash[linkhash];
- ff_pkt->linkhash[linkhash] = lp;
+ lp->next = ff_pkt->linkhash[linkhash];
+ ff_pkt->linkhash[linkhash] = lp;
ff_pkt->linked = lp; /* mark saved link */
} else {
ff_pkt->linked = NULL;
} else {
ff_pkt->type = FT_DIRBEGIN;
}
- /* We have set st_rdev to 1 if it is a reparse point, otherwise 0 */
- if (have_win32_api() && ff_pkt->statp.st_rdev) {
+ /*
+ * We have set st_rdev to 1 if it is a reparse point, otherwise 0,
+ * if st_rdev is 2, it is a mount point
+ */
+ if (have_win32_api() && ff_pkt->statp.st_rdev == 1) {
ff_pkt->type = FT_REPARSE;
}
/*
jcr->wait_time = time(NULL);
}
}
- Dmsg3(100, "jid=%u OnExit JobStatus=%c set=%c\n", (uint32_t)jcr->JobId,
+ Dmsg3(100, "jid=%u Exit set_jcr_job_status=%c set=%c\n", (uint32_t)jcr->JobId,
jcr->JobStatus, JobStatus);
}
struct timeval tv;
struct timezone tz;
struct timespec timeout;
- int errstat;
+ int errstat = 0;
Dsm_check(1);
Dmsg1(200, "Run_cmd: %s\n", jcr->dir_bsock->msg);
timeout.tv_sec = tv.tv_sec + me->client_wait;
Dmsg3(050, "%s waiting %d sec for FD to contact SD key=%s\n",
- jcr->Job, (int)me->client_wait, jcr->sd_auth_key);
+ jcr->Job, (int)(timeout.tv_sec-time(NULL)), jcr->sd_auth_key);
/*
* Wait for the File daemon to contact us to start the Job,
break;
}
}
+ Dmsg3(100, "Auth=%d canceled=%d errstat=%d\n", jcr->authenticated,
+ job_canceled(jcr), errstat);
V(mutex);
memset(jcr->sd_auth_key, 0, strlen(jcr->sd_auth_key));
{
JCR *jcr;
- bmicrosleep(0, 50000); /* wait 50 millisecs */
+/*
+ * With the following bmicrosleep on, running the
+ * SD under the debugger fails.
+ */
+// bmicrosleep(0, 50000); /* wait 50 millisecs */
if (!(jcr=get_jcr_by_full_name(job_name))) {
Jmsg1(NULL, M_FATAL, 0, _("FD connect failed: Job name not found: %s\n"), job_name);
- Dmsg1(3, "**** Job \"%s\" not found", job_name);
+ Dmsg1(3, "**** Job \"%s\" not found.\n", job_name);
return;
}
General:
01May08
+kes Fix strippath so that it does not get a buffer overrun and crash FD.
+ This fixes bug #1078.
+kes Remove 50 millisec wait in SD that broke debugger.
ebl Add MaxRunSchedTime option that specifies the maximum allowed time
that a job may run, counted from when the job was scheduled.
ebl Fix MaxWaitTime option that specifies the maximum allowed time that