From 1f337f292d1c98c396d5f8d5d294f9ba13963586 Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Mon, 26 May 2014 14:03:20 +0100 Subject: [PATCH] Fix fread error handling. --- desktop/searchweb.c | 1 + utils/errors.h | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/desktop/searchweb.c b/desktop/searchweb.c index b75f4139d..9de75bcd8 100644 --- a/desktop/searchweb.c +++ b/desktop/searchweb.c @@ -138,6 +138,7 @@ read_providers(const char *fname, if (fread(providersd, 1, fsize, providersf) != fsize) { fclose(providersf); free(providersd); + return NSERROR_BAD_SIZE; } providersd[fsize] = 0; /* ensure null terminated */ diff --git a/utils/errors.h b/utils/errors.h index bfb659d03..aa0179a37 100644 --- a/utils/errors.h +++ b/utils/errors.h @@ -75,7 +75,9 @@ typedef enum { NSERROR_PERMISSION, /**< Permission error */ - NSERROR_NOSPACE /**< Insufficient space */ + NSERROR_NOSPACE, /**< Insufficient space */ + + NSERROR_BAD_SIZE /**< Bad size */ } nserror; #endif