Try to fix "infinite loop" warning on AIX and other compilers. (We
authorMartin Pool <mbp@samba.org>
Mon, 6 Aug 2001 12:25:45 +0000 (12:25 +0000)
committerMartin Pool <mbp@samba.org>
Mon, 6 Aug 2001 12:25:45 +0000 (12:25 +0000)
exit on a signal.)

main.c
util.c

diff --git a/main.c b/main.c
index 4ecf46d..bc51571 100644 (file)
--- 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 df2af3e..50fdaf8 100644 (file)
--- 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 <mbp@samba.org>
    
    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;
 }