r17633: Return NULL at the end of the file, or else we can't tell the
authorAndrew Bartlett <abartlet@samba.org>
Sun, 20 Aug 2006 21:57:08 +0000 (21:57 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 19:16:17 +0000 (14:16 -0500)
difference between end of file and a blank line.

Andrew Bartlett
(This used to be commit 6fd6239a0f16154c13713bf1398b2873d1103335)

source4/lib/util/util_file.c

index 99432ad8bbd4a4a7bba76d27fcd512d663c49078..345171205335a70b8227f1311a88e0d27d1fc711 100644 (file)
@@ -125,6 +125,10 @@ _PUBLIC_ char *afdgets(int fd, TALLOC_CTX *mem_ctx, size_t hint)
 
                ret = read(fd, data + offset, hint);
 
+               if (ret == 0) {
+                       return NULL;
+               }
+
                if (ret == -1) {
                        talloc_free(data);
                        return NULL;