changeset 236:8189be40ed7c

Oops, dmfgets() had a nasty think-o and counted the remaining buffer space incorrectly. It also did not return NULL when expected, as per stdlib fgets(). Fixed.
author Matti Hamalainen <ccr@tnsp.org>
date Tue, 09 Oct 2012 03:45:52 +0300
parents 4a672d96978f
children 6d9d43bb68eb
files dmres.c
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/dmres.c	Mon Oct 08 15:45:38 2012 +0300
+++ b/dmres.c	Tue Oct 09 03:45:52 2012 +0300
@@ -796,12 +796,12 @@
         if (n < size - 1)
         {
             *p++ = c;
-            size--;
+            n++;
         }
     }
     *p = 0;
     
-    return s;
+    return (n > 0) ? s : NULL;
 }