[or-cvs] Fix a bug in last patch; and keep my name out of the assert...
Nick Mathewson
nickm at seul.org
Wed Dec 22 02:46:31 UTC 2004
Update of /home/or/cvsroot/tor/src/common
In directory moria.mit.edu:/tmp/cvs-serv709/src/common
Modified Files:
compat.c util.h
Log Message:
Fix a bug in last patch; and keep my name out of the assert() call too.
Index: compat.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/common/compat.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- compat.c 22 Dec 2004 02:32:26 -0000 1.23
+++ compat.c 22 Dec 2004 02:46:28 -0000 1.24
@@ -122,18 +122,19 @@
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
Index: util.h
===================================================================
RCS file: /home/or/cvsroot/tor/src/common/util.h,v
retrieving revision 1.125
retrieving revision 1.126
diff -u -d -r1.125 -r1.126
--- util.h 22 Dec 2004 02:32:26 -0000 1.125
+++ util.h 22 Dec 2004 02:46:28 -0000 1.126
@@ -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
More information about the tor-commits
mailing list