From e1bd49d6f3f7a5793cc9cd06d57498ce976f81e0 Mon Sep 17 00:00:00 2001 From: Martin Pool Date: Mon, 6 Aug 2001 12:25:45 +0000 Subject: [PATCH] Try to fix "infinite loop" warning on AIX and other compilers. (We exit on a signal.) --- main.c | 3 ++- util.c | 14 ++++++++++---- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/main.c b/main.c index 4ecf46d1..bc51571f 100644 --- a/main.c +++ b/main.c @@ -360,7 +360,8 @@ static int do_recv(int f_in,int f_out,struct file_list *flist,char *local_name) /* finally we go to sleep until our parent kills us with a USR2 signal. We sleep for a short time as on some OSes a signal won't interrupt a sleep! */ - while (1) msleep(20); + while (msleep(20)) + ; } close(recv_pipe[1]); diff --git a/util.c b/util.c index df2af3e8..50fdaf8e 100644 --- a/util.c +++ b/util.c @@ -2,6 +2,7 @@ Copyright (C) 1996-2000 by Andrew Tridgell Copyright (C) Paul Mackerras 1996 + Copyright (C) 2001 by Martin Pool This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -901,10 +902,13 @@ char *timestring(time_t t) } -/******************************************************************* -sleep for a specified number of milliseconds -********************************************************************/ -void msleep(int t) +/** + * Sleep for a specified number of milliseconds. + * + * Always returns TRUE. (In the future it might return FALSE if + * interrupted.) + **/ +int msleep(int t) { int tdiff=0; struct timeval tval,t1,t2; @@ -923,6 +927,8 @@ void msleep(int t) tdiff = (t2.tv_sec - t1.tv_sec)*1000 + (t2.tv_usec - t1.tv_usec)/1000; } + + return True; } -- 2.34.1