aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Framework/Serialization/TarArchiveWriter.cs39
1 files changed, 23 insertions, 16 deletions
diff --git a/OpenSim/Framework/Serialization/TarArchiveWriter.cs b/OpenSim/Framework/Serialization/TarArchiveWriter.cs
index d319b0b..316a8de 100644
--- a/OpenSim/Framework/Serialization/TarArchiveWriter.cs
+++ b/OpenSim/Framework/Serialization/TarArchiveWriter.cs
@@ -109,10 +109,14 @@ namespace OpenSim.Framework.Serialization
109 109
110 // Write two consecutive 0 blocks to end the archive 110 // Write two consecutive 0 blocks to end the archive
111 byte[] finalZeroPadding = new byte[1024]; 111 byte[] finalZeroPadding = new byte[1024];
112 m_bw.Write(finalZeroPadding);
113 112
114 m_bw.Flush(); 113 lock (m_bw)
115 m_bw.Close(); 114 {
115 m_bw.Write(finalZeroPadding);
116
117 m_bw.Flush();
118 m_bw.Close();
119 }
116 } 120 }
117 121
118 public static byte[] ConvertDecimalToPaddedOctalBytes(int d, int padding) 122 public static byte[] ConvertDecimalToPaddedOctalBytes(int d, int padding)
@@ -197,20 +201,23 @@ namespace OpenSim.Framework.Serialization
197 201
198 header[154] = 0; 202 header[154] = 0;
199 203
200 // Write out header 204 lock (m_bw)
201 m_bw.Write(header);
202
203 // Write out data
204 m_bw.Write(data);
205
206 if (data.Length % 512 != 0)
207 { 205 {
208 int paddingRequired = 512 - (data.Length % 512); 206 // Write out header
209 207 m_bw.Write(header);
210 //m_log.DebugFormat("[TAR ARCHIVE WRITER]: Padding data with {0} bytes", paddingRequired); 208
211 209 // Write out data
212 byte[] padding = new byte[paddingRequired]; 210 m_bw.Write(data);
213 m_bw.Write(padding); 211
212 if (data.Length % 512 != 0)
213 {
214 int paddingRequired = 512 - (data.Length % 512);
215
216 //m_log.DebugFormat("[TAR ARCHIVE WRITER]: Padding data with {0} bytes", paddingRequired);
217
218 byte[] padding = new byte[paddingRequired];
219 m_bw.Write(padding);
220 }
214 } 221 }
215 } 222 }
216 } 223 }