Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
change some sprintf into snprintf
[simgrid.git] / examples / msg / actions-storage / actions-storage.c
index 4165f23..76d399a 100644 (file)
@@ -1,5 +1,4 @@
-/* Copyright (c) 2015. The SimGrid Team.
- * All rights reserved.                                                     */
+/* Copyright (c) 2015-2016. The SimGrid Team. All rights reserved.          */
 
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
@@ -8,11 +7,6 @@
 #include <xbt/replay.h>
 
 XBT_LOG_NEW_DEFAULT_CATEGORY(storage_actions, "Messages specific for this example");
 #include <xbt/replay.h>
 
 XBT_LOG_NEW_DEFAULT_CATEGORY(storage_actions, "Messages specific for this example");
-/** @addtogroup MSG_examples
- *
- *  - <b>I/O: actions-comm/actions-comm.c</b>. This example comes with a set of event handlers reproducing
- *  some classical I/O primitives (open, read, write, close, ...).
- */
 
 static xbt_dict_t opened_files = NULL;
 
 
 static xbt_dict_t opened_files = NULL;
 
@@ -36,7 +30,7 @@ static msg_file_t get_file_descriptor(const char *file_name){
   char full_name[1024];
   msg_file_t file = NULL;
 
   char full_name[1024];
   msg_file_t file = NULL;
 
-  sprintf(full_name, "%s:%s", MSG_process_get_name(MSG_process_self()), file_name);
+  snprintf(full_name,1023, "%s:%s", MSG_process_get_name(MSG_process_self()), file_name);
 
   file = (msg_file_t) xbt_dict_get_or_null(opened_files, full_name);
   return file;
 
   file = (msg_file_t) xbt_dict_get_or_null(opened_files, full_name);
   return file;
@@ -58,7 +52,7 @@ static void action_open(const char *const *action) {
   msg_file_t file = NULL;
   double clock = MSG_get_clock();
 
   msg_file_t file = NULL;
   double clock = MSG_get_clock();
 
-  sprintf(full_name, "%s:%s", MSG_process_get_name(MSG_process_self()), file_name);
+  snprintf(full_name,1023, "%s:%s", MSG_process_get_name(MSG_process_self()), file_name);
 
   ACT_DEBUG("Entering Open: %s (filename: %s)", NAME, file_name);
   file = MSG_file_open(file_name, NULL);
 
   ACT_DEBUG("Entering Open: %s (filename: %s)", NAME, file_name);
   file = MSG_file_open(file_name, NULL);