Commit d57a7484 authored by Per Cederqvist's avatar Per Cederqvist

(dump_connections): If the rename of the file fails with ENOENT, retry

	it a few times before giving up.  This is an attempt to work
	around an automount problem on the Xenofarm at Lysator.
parent 00dc7543
/*
* $Id: connections.c,v 0.126 2003/08/22 08:53:14 ceder Exp $
* $Id: connections.c,v 0.127 2003/08/22 09:01:03 ceder Exp $
* Copyright (C) 1991-2002 Lysator Academic Computer Association.
*
* This file is part of the LysKOM server.
......@@ -591,6 +591,8 @@ dump_connections(void)
Session_no s;
Connection *conn;
FILE *fp;
int retry;
int rv;
if ((fp = i_fopen(param.connection_status_file_tmp, "w")) == NULL)
{
......@@ -619,15 +621,29 @@ dump_connections(void)
strerror(errno));
}
errno = 0;
if (i_rename(param.connection_status_file_tmp,
param.connection_status_file) < 0)
for (retry = 0; ; retry++)
{
kom_log("dump_connections(): can't rename %s to %s: %s\n",
param.connection_status_file_tmp,
param.connection_status_file,
strerror(errno));
rv = i_rename(param.connection_status_file_tmp,
param.connection_status_file);
if (rv == 0)
break;
if (errno != ENOENT || retry > 5)
{
kom_log("dump_connections():"
" can't rename %s to %s: %s (retry=%d)\n",
param.connection_status_file_tmp,
param.connection_status_file,
strerror(errno),
retry);
}
if (retry > 3)
sleep(1);
}
if (retry != 0)
kom_log("dump_connections(): rename OK on try %d\n", retry);
}
......
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