Commit 491901e5 authored by claes's avatar claes

Added fsync-call to ensure that buffers are written to disk

parent 619fce4c
/* /*
* Proview $Id: rt_bck.c,v 1.12 2008-03-31 13:47:39 claes Exp $ * Proview $Id: rt_bck.c,v 1.13 2008-04-16 08:34:04 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB. * Copyright (C) 2005 SSAB Oxelsund AB.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
...@@ -601,6 +601,7 @@ bck_file_process ( ...@@ -601,6 +601,7 @@ bck_file_process (
pwr_tUInt32 csts; pwr_tUInt32 csts;
pwr_tUInt32 cnt; pwr_tUInt32 cnt;
char fname[200]; char fname[200];
int fd;
#if defined OS_VMS || defined OS_ELN #if defined OS_VMS || defined OS_ELN
...@@ -695,6 +696,8 @@ bck_file_process ( ...@@ -695,6 +696,8 @@ bck_file_process (
if (bckfile == NULL) if (bckfile == NULL)
perror("BACKUP cannot create backupfile"); perror("BACKUP cannot create backupfile");
else { else {
fd = fileno(bckfile);
errh_Info("BACKUP created new backupfile %s", FGETNAME); errh_Info("BACKUP created new backupfile %s", FGETNAME);
memset(&filehead, 0, sizeof filehead); memset(&filehead, 0, sizeof filehead);
...@@ -773,6 +776,12 @@ bck_file_process ( ...@@ -773,6 +776,12 @@ bck_file_process (
csts = fflush(bckfile); csts = fflush(bckfile);
if (csts != 0) break; if (csts != 0) break;
#endif #endif
/* Sync writing of kernel buffers to disk */
csts = fsync(fd);
if (csts != 0) break;
/* Update statistics in the configuration block */ /* Update statistics in the configuration block */
backup_confp->LastWrite = filehead.updatetime [c]; backup_confp->LastWrite = filehead.updatetime [c];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment