aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2004-12-22 02:46:28 +0000
committerNick Mathewson <nickm@torproject.org>2004-12-22 02:46:28 +0000
commitc79c4200f43680da35849c03fe7fd7705a400d01 (patch)
treed230ac430bfc7f4ecc0bd25c6d36e8e1bc62acf5 /src
parent32978afa5481f66c9ff4fb7ededbdecf6800c16c (diff)
downloadtor-c79c4200f43680da35849c03fe7fd7705a400d01.tar.gz
tor-c79c4200f43680da35849c03fe7fd7705a400d01.zip
Fix a bug in last patch; and keep my name out of the assert() call too.
svn:r3200
Diffstat (limited to 'src')
-rw-r--r--src/common/compat.c11
-rw-r--r--src/common/util.h3
2 files changed, 8 insertions, 6 deletions
diff --git a/src/common/compat.c b/src/common/compat.c
index 1b00c6395d..bad94c3eea 100644
--- a/src/common/compat.c
+++ b/src/common/compat.c
@@ -122,18 +122,19 @@ int tor_vsnprintf(char *str, size_t size, const char *format, va_list args)
const char *
_tor_fix_source_file(const char *fname)
{
- const char *cp1, *cp2;
+ const char *cp1, *cp2, *r;
cp1 = strrchr(fname, '/');
cp2 = strrchr(fname, '\\');
if (cp1 && cp2) {
- return (cp1<cp2)?(cp2+1):(cp1+1);
+ r = (cp1<cp2)?(cp2+1):(cp1+1);
} else if (cp1) {
- return cp1+1;
+ r = cp1+1;
} else if (cp2) {
- return cp2+2;
+ r = cp2+1;
} else {
- return fname;
+ r = fname;
}
+ return r;
}
#ifndef UNALIGNED_INT_ACCESS_OK
diff --git a/src/common/util.h b/src/common/util.h
index f1b1bff613..a37018bf3d 100644
--- a/src/common/util.h
+++ b/src/common/util.h
@@ -40,7 +40,8 @@
if (!(expr)) { \
log(LOG_ERR, "%s:%d: %s: Assertion %s failed; aborting.", \
_SHORT_FILE_, __LINE__, __FUNCTION__, #expr); \
- assert(expr); /* write to console too. */ \
+ fprintf(stderr,"%s:%d %s: Assertion %s failed; aborting.\n", \
+ _SHORT_FILE_, __LINE__, __FUNCTION__, #expr); \
abort(); /* unreached */ \
} } while (0)
#endif