X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/177f020f122827214159c46dcfe7ded1e3c8d1c3..0bd17f9ffc647f61203f9cb28321142527ac85e2:/uip/dropsbr.c diff --git a/uip/dropsbr.c b/uip/dropsbr.c index a02e29c4..c492b18a 100644 --- a/uip/dropsbr.c +++ b/uip/dropsbr.c @@ -12,6 +12,8 @@ #include #include #include +#include "../sbr/lock_file.h" +#include "../sbr/m_mktemp.h" #ifdef NTOHLSWAP # include @@ -46,19 +48,16 @@ mbx_open (char *file, int mbx_style, uid_t uid, gid_t gid, mode_t mode) /* attempt to open and lock file */ for (count = 4; count > 0; count--) { int failed_to_lock = 0; - if ((fd = lkopenspool (file, O_RDWR | O_CREAT | - O_NONBLOCK, mode, &failed_to_lock)) == NOTOK) { - if (failed_to_lock) { - j = errno; - sleep (5); - continue; - } else { - return NOTOK; - } - } - /* good file descriptor */ - break; + if ((fd = lkopenspool (file, O_RDWR | O_CREAT | O_NONBLOCK, + mode, &failed_to_lock)) != NOTOK) + break; + + if (!failed_to_lock) + return NOTOK; + + j = errno; + sleep (5); } errno = j;