Added fsync call to dexopt.

If various system-level things go wrong you might end up with a
correctly-written .odex header but an incomplete file, which ideally
would never happen.  This adds an fsync() call before we write the
header to make this less likely.

Change-Id: Ie5ac67dc7185ca9a4995710688e1219e46477c12
diff --git a/vm/Thread.c b/vm/Thread.c
index 9024312..e46715d 100644
--- a/vm/Thread.c
+++ b/vm/Thread.c
@@ -2741,8 +2741,9 @@
  * lock and suspend lock here (and we're not using recursive threads), and
  * we might have to self-suspend if somebody else beats us here.
  *
- * The current thread may not be attached to the VM.  This can happen if
- * we happen to GC as the result of an allocation of a Thread object.
+ * We know the current thread is in the thread list, because we attach the
+ * thread before doing anything that could cause VM suspension (like object
+ * allocation).
  */
 void dvmSuspendAllThreads(SuspendCause why)
 {