]> git.notmuchmail.org Git - notmuch/blobdiff - compat/getdelim.c
Merge branch 'debian' into rebuild
[notmuch] / compat / getdelim.c
index b74e5b5350055d63cbd667bdb3c7625ce88fca44..407f3d07c7443836a11b5dbc9236337e7e6294e7 100644 (file)
@@ -19,7 +19,7 @@
 
 /* Ported from glibc by Simon Josefsson. */
 
-#include <config.h>
+#include "compat.h"
 
 #include <stdio.h>
 
@@ -54,7 +54,7 @@
 ssize_t
 getdelim (char **lineptr, size_t *n, int delimiter, FILE *fp)
 {
-  ssize_t result;
+  ssize_t result = -1;
   size_t cur_len = 0;
 
   if (lineptr == NULL || n == NULL || fp == NULL)
@@ -124,7 +124,7 @@ getdelim (char **lineptr, size_t *n, int delimiter, FILE *fp)
        break;
     }
   (*lineptr)[cur_len] = '\0';
-  result = cur_len ? cur_len : result;
+  result = cur_len ? (ssize_t) cur_len : result;
 
  unlock_return:
   funlockfile (fp); /* doesn't set errno */