From: Alan T. DeKok Date: Wed, 15 Nov 2017 18:24:08 +0000 (-0500) Subject: try renaming detail* to detail.work only once X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=687fa5c4cfe4ca5676f5998db6568123bc06d6a5;p=thirdparty%2Ffreeradius-server.git try renaming detail* to detail.work only once --- diff --git a/src/modules/proto_detail/proto_detail_file.c b/src/modules/proto_detail/proto_detail_file.c index 0d06ce9e1f8..146b42a5abb 100644 --- a/src/modules/proto_detail/proto_detail_file.c +++ b/src/modules/proto_detail/proto_detail_file.c @@ -425,9 +425,8 @@ static void mod_vnode_delete(fr_event_list_t *el, int fd, UNUSED int fflags, voi static void work_init(proto_detail_file_t *inst) { - int fd, tries; - - tries = 0; + int fd; + bool renamed = false; /* * See if there is a "detail.work" file. If not, try to @@ -440,11 +439,12 @@ redo: struct timeval when, now; /* - * Rename a "detail*" to "detail.work" file. + * Rename a "detail*" to "detail.work" filem but + * only try once. */ - if (work_rename(inst) == 0) { - tries++; - if (tries < 5) goto redo; + if (!renamed && (work_rename(inst) < 0)) { + renamed = true; + goto redo; } #ifdef __LINUX__