/*
Bacula® - The Network Backup Solution
- Copyright (C) 2000-2010 Free Software Foundation Europe e.V.
+ Copyright (C) 2000-2011 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.
} else {
l = argv[0];
#if defined(HAVE_WIN32)
- /* On Windows allow c: junk */
+ /* On Windows allow c: drive specification */
if (l[1] == ':') {
l += 2;
}
/*********************************************************************
*
- * This subroutine returns the filename portion of a Windows
- * path. It is used because Microsoft Visual Studio sets __FILE__
- * to the full path.
+ * This subroutine returns the filename portion of a path.
+ * It is used because some compilers set __FILE__
+ * to the full path. Try to return base + next higher path.
*/
-inline const char *
+const char *
get_basename(const char *pathname)
{
-#if defined(_MSC_VER)
- const char *basename;
+ const char *basename, *basename2;
- if ((basename = strrchr(pathname, '\\')) == NULL) {
+ if ((basename = strrchr(pathname, PathSeparator)) == NULL) {
basename = pathname;
+ if ((basename2 = strrchr(pathname, PathSeparator)) != NULL) {
+ basename = basename2 + 1;
+ }
} else {
basename++;
}
return basename;
-#else
- return pathname;
-#endif
}
/*
POOLMEM *pool_buf;
pool_buf = get_pool_memory(PM_EMSG);
- i = Mmsg(pool_buf, "%s:%d ", file, line);
+ i = Mmsg(pool_buf, "%s:%d ", get_basename(file), line);
for (;;) {
maxlen = sizeof_pool_memory(pool_buf) - i - 1;
/*
Bacula® - The Network Backup Solution
- Copyright (C) 2000-2009 Free Software Foundation Europe e.V.
+ Copyright (C) 2000-2011 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.
void Jmsg(JCR *jcr, int type, utime_t mtime, const char *fmt,...);
void Qmsg(JCR *jcr, int type, utime_t mtime, const char *fmt,...);
bool get_trace(void);
+const char *get_basename(const char *pathname);
+
struct B_DB;
typedef void (*sql_query_func)(JCR *jcr, const char *cmd);
/*
Bacula® - The Network Backup Solution
- Copyright (C) 2000-2010 Free Software Foundation Europe e.V.
+ Copyright (C) 2000-2011 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.
P(mutex);
Dmsg4(1150, "sm_free %d at %p from %s:%d\n",
head->ablen, fp,
- head->abfname, head->ablineno);
+ get_basename(head->abfname), head->ablineno);
if (!head->abin_use) {
V(mutex);
V(mutex);
Dmsg4(0, "Overrun buffer: len=%d addr=%p allocated: %s:%d\n",
head->ablen, fp,
- head->abfname, head->ablineno);
+ get_basename(head->abfname), head->ablineno);
Emsg2(M_ABORT, 0, _("Buffer overrun called from %s:%d\n"), file, line);
}
if (sm_buffers > 0) {
void *buf;
char *cp = (char *) ptr;
- Dmsg4(1400, "sm_realloc %s:%d %p %d\n", fname, (uint32_t)lineno, ptr, size);
+ Dmsg4(1400, "sm_realloc %s:%d %p %d\n", get_basename(fname), (uint32_t)lineno, ptr, size);
if (size <= 0) {
e_msg(fname, lineno, M_ABORT, 0, _("sm_realloc size: %d\n"), size);
}
/* All done. Free and dechain the original buffer. */
sm_free(fname, lineno, ptr);
}
- Dmsg4(4150, _("sm_realloc %d at %p from %s:%d\n"), size, buf, fname, (uint32_t)lineno);
+ Dmsg4(4150, _("sm_realloc %d at %p from %s:%d\n"), size, buf, get_basename(fname), (uint32_t)lineno);
return buf;
}
Pmsg6(0, "%s buffer: %s %d bytes at %p from %s:%d\n",
in_use?"In use":"Orphaned",
- my_name, memsize, cp, ap->abfname, ap->ablineno);
+ my_name, memsize, cp, get_basename(ap->abfname), ap->ablineno);
if (bufdump) {
char buf[20];
unsigned llen = 0;
{
if (!sm_check_rtn(fname, lineno, bufdump)) {
Emsg2(M_ABORT, 0, _("Damaged buffer found. Called from %s:%d\n"),
- fname, (uint32_t)lineno);
+ get_basename(fname), (uint32_t)lineno);
}
}
badbuf |= bad;
if (bad) {
Pmsg2(0,
- _("\nDamaged buffers found at %s:%d\n"), fname, (uint32_t)lineno);
+ _("\nDamaged buffers found at %s:%d\n"), get_basename(fname), (uint32_t)lineno);
if (bad & 0x1) {
Pmsg0(0, _(" discovery of bad prev link.\n"));
Pmsg4(0,
_("Damaged buffer: %6u bytes allocated at line %d of %s %s\n"),
- memsize, ap->ablineno, my_name, ap->abfname
+ memsize, ap->ablineno, my_name, get_basename(ap->abfname)
);
if (bufdump) {
unsigned llen = 0;