Whamcloud - gitweb
Branch HEAD
authoradilger <adilger>
Thu, 15 May 2008 16:36:58 +0000 (16:36 +0000)
committeradilger <adilger>
Thu, 15 May 2008 16:36:58 +0000 (16:36 +0000)
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

index 4b275e6..9810bdb 100644 (file)
@@ -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,