summaryrefslogtreecommitdiff
path: root/common/trace
diff options
context:
space:
mode:
authorDmitri Pal <dpal@redhat.com>2009-08-12 13:41:56 -0400
committerStephen Gallagher <sgallagh@redhat.com>2009-08-17 09:38:59 -0400
commit7385f34a3c8c68cf0f87d64e55e0ca44f46fdeaa (patch)
treecbadc0a90da029f060270d5c9541b042c8d92a79 /common/trace
parentc1567c42389e296a2b8bdb61694a8ac906b9982b (diff)
downloadsssd-7385f34a3c8c68cf0f87d64e55e0ca44f46fdeaa.tar.gz
sssd-7385f34a3c8c68cf0f87d64e55e0ca44f46fdeaa.tar.bz2
sssd-7385f34a3c8c68cf0f87d64e55e0ca44f46fdeaa.zip
TRACE: Making sure trace is safe to output NULL strings
Patch adds checks for NULL to the trace macros. It also eliminates the unused trace.h in the collection directory.
Diffstat (limited to 'common/trace')
-rw-r--r--common/trace/trace.h9
1 files changed, 6 insertions, 3 deletions
diff --git a/common/trace/trace.h b/common/trace/trace.h
index 9211e20d..b2604fd5 100644
--- a/common/trace/trace.h
+++ b/common/trace/trace.h
@@ -45,7 +45,8 @@ extern unsigned trace_level;
do { \
if (level & trace_level) { \
printf("[DEBUG] %23s (%4d) %s %s\n", \
- __FILE__, __LINE__, msg, str); \
+ __FILE__, __LINE__, (msg != NULL) ? msg : "MISSING MESSAGE", \
+ (str != NULL) ? str : "(null)"); \
} \
} while(0)
@@ -54,7 +55,8 @@ extern unsigned trace_level;
do { \
if (level & trace_level) { \
printf("[DEBUG] %23s (%4d) %s %lu\n", \
- __FILE__, __LINE__, msg, (unsigned long int)(num)); \
+ __FILE__, __LINE__, (msg != NULL) ? msg : "MISSING MESSAGE", \
+ (unsigned long int)(num)); \
} \
} while(0)
@@ -63,7 +65,8 @@ extern unsigned trace_level;
do { \
if (level & trace_level) { \
printf("[DEBUG] %23s (%4d) %s %e\n", \
- __FILE__, __LINE__, msg, (double)(num)); \
+ __FILE__, __LINE__, (msg != NULL) ? msg : "MISSING MESSAGE", \
+ (double)(num)); \
} \
} while(0)