From 3eab1de2dc4da51cee520b6de5b7a790e214757b Mon Sep 17 00:00:00 2001
From: Giovanni Bussi <giovanni.bussi@gmail.com>
Date: Tue, 22 Nov 2016 10:57:42 +0100
Subject: [PATCH] Fix lammps patch

When using extra arguments after the name of the log file,
the former could have been overwritten by reeplica suffix.

Bug reported by Marco De La Pierre.
---
 patches/lammps-6Apr13/fix_plumed.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/patches/lammps-6Apr13/fix_plumed.cpp b/patches/lammps-6Apr13/fix_plumed.cpp
index d91009aed..42763be06 100644
--- a/patches/lammps-6Apr13/fix_plumed.cpp
+++ b/patches/lammps-6Apr13/fix_plumed.cpp
@@ -103,9 +103,9 @@ FixPlumed::FixPlumed(LAMMPS *lmp, int narg, char **arg) :
     else if(next==1){
       // Each replica writes an independent log file
       //  with suffix equal to the replica id
-      char str_num[32], *logFile;
+      char str_num[32], logFile[1024];
       sprintf(str_num,".%d",universe->iworld);
-      logFile=arg[i];
+      strncpy(logFile,arg[i],1024);
       strcat(logFile,str_num);
       p->cmd("setLogFile",logFile);
       next=0;
-- 
GitLab