incorporated Tom Quinn's suggestion on calling flush before fclose.
authorGengbin Zheng <gzheng@illinois.edu>
Wed, 10 Nov 2010 15:24:36 +0000 (09:24 -0600)
committerGengbin Zheng <gzheng@illinois.edu>
Wed, 10 Nov 2010 15:24:36 +0000 (09:24 -0600)
src/util/pup_util.C

index b2cb6e97d31098198206869208426e7c12ce173f..8d491191c77171edf9b68f42a0865d9251077869 100644 (file)
@@ -175,6 +175,16 @@ FILE *CmiFopen(const char *path, const char *mode)
 int CmiFclose(FILE *fp)
 {
         int status = 0;
+        while (1) {
+          status = fflush(fp);
+          if (status != 0 && errno==EINTR) {
+            printf("Warning: CmiFclose flush retrying ...\n");
+            continue;
+          }
+          else
+            break;
+        }
+        if (status != 0) return status;
         while (1) {
           status = fclose(fp);
           if (status != 0 && errno==EINTR) {