X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=blobdiff_plain;f=compat%2Fgetdelim.c;h=407f3d07c7443836a11b5dbc9236337e7e6294e7;hp=b74e5b5350055d63cbd667bdb3c7625ce88fca44;hb=e2dd4ac00b9979de34bd517fa57de56260d38755;hpb=96c9109d94ddd985994cb431080d2823688b0ed6 diff --git a/compat/getdelim.c b/compat/getdelim.c index b74e5b53..407f3d07 100644 --- a/compat/getdelim.c +++ b/compat/getdelim.c @@ -19,7 +19,7 @@ /* Ported from glibc by Simon Josefsson. */ -#include +#include "compat.h" #include @@ -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 */