From 1e14af95262afbc77829f3b371d5bbba96d6802d Mon Sep 17 00:00:00 2001 From: adilger <adilger> Date: Thu, 15 May 2008 16:36:58 +0000 Subject: [PATCH] Branch HEAD Limit snprintf/strncpy modification of debug_file_name to sizeof(debug_file_name) instead of sizeof(debug_file_path). Both are currently the same size, but may change at some point in the future. --- lnet/libcfs/debug.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lnet/libcfs/debug.c b/lnet/libcfs/debug.c index 4b275e6f86..9810bdb900 100644 --- a/lnet/libcfs/debug.c +++ b/lnet/libcfs/debug.c @@ -406,7 +406,7 @@ void libcfs_debug_dumplog_internal(void *arg) CFS_PUSH_JOURNAL; if (strncmp(debug_file_path, "NONE", 4) != 0) { - snprintf(debug_file_name, sizeof(debug_file_path) - 1, + snprintf(debug_file_name, sizeof(debug_file_name) - 1, "%s.%ld.%ld", debug_file_path, cfs_time_current_sec(), (long)arg); printk(KERN_ALERT "LustreError: dumping log to %s\n", @@ -653,7 +653,7 @@ int libcfs_debug_init(unsigned long bufsize) debug_filename = getenv("LIBLUSTRE_DEBUG_FILE"); if (debug_filename) - strncpy(debug_file_name,debug_filename,sizeof(debug_file_path)); + strncpy(debug_file_name,debug_filename,sizeof(debug_file_name)); if (debug_file_name[0] == '\0' && debug_file_path[0] != '\0') snprintf(debug_file_name, sizeof(debug_file_name) - 1, -- GitLab