[tpop3d-discuss] double while loop...

ZUKERAN, shin shin at opus.or.jp
Wed, 21 Aug 2002 21:50:26 +0900


Hi, Chris

I am investigating the source code of tpop3d and found a wonderful description. 
Two same 'while' phrases are in one block. 

If there is no meaning special to this portion,
I propose deleting one of the two. 

----
ZUKERAN, shin


--- util.c	Sat Jun  8 18:35:13 2002
+++ util.c.zu	Wed Aug 21 21:38:13 2002
@@ -31,21 +31,21 @@
  * Write some data, taking account of short writes and signals. */
 ssize_t xwrite(int fd, const void *buf, size_t count) {
     size_t c = count;
     const char *b = (const char*)buf;
     while (c > 0) {
         int e = write(fd, b, c);
         if (e >= 0) {
             c -= e;
             b += e;
         } else if (errno != EINTR) return e;
-    } while (c > 0);
+    }
     return count;
 }
 
 /* daemon:
  * Become a daemon. From `The Unix Programming FAQ', Andrew Gierth et al. */
 int daemon(int nochdir, int noclose) {
     switch (fork()) {
         case 0:  break;
         case -1: return -1;
         default: _exit(0);          /* exit the original process */