From d80f189a015e725346e0c8509a83ccb33f7eee60 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Wed, 4 Apr 2012 11:24:44 +0000 Subject: [PATCH] -allow NULL for emsg --- src/fs/Makefile.am | 5 +++++ src/fs/fs_download.c | 9 ++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/fs/Makefile.am b/src/fs/Makefile.am index d8d05eb8d..cf6cab849 100644 --- a/src/fs/Makefile.am +++ b/src/fs/Makefile.am @@ -226,6 +226,11 @@ check_SCRIPTS = \ test_gnunet_fs_ns.py endif +if ENABLE_MONKEY + TESTS_ENVIRONMENT = @MONKEYPREFIX@ + AM_LDFLAGS = -no-install +endif + if ENABLE_TEST_RUN TESTS = \ diff --git a/src/fs/fs_download.c b/src/fs/fs_download.c index d91c9e824..8ae4a29fb 100644 --- a/src/fs/fs_download.c +++ b/src/fs/fs_download.c @@ -1773,16 +1773,19 @@ fh_reader (void *cls, uint64_t offset, size_t max, void *buf, char **emsg) struct GNUNET_DISK_FileHandle *fh = dc->rfh; ssize_t ret; - *emsg = NULL; + if (NULL != emsg) + *emsg = NULL; if (offset != GNUNET_DISK_file_seek (fh, offset, GNUNET_DISK_SEEK_SET)) { - *emsg = GNUNET_strdup (strerror (errno)); + if (NULL != emsg) + *emsg = GNUNET_strdup (strerror (errno)); return 0; } ret = GNUNET_DISK_file_read (fh, buf, max); if (ret < 0) { - *emsg = GNUNET_strdup (strerror (errno)); + if (NULL != emsg) + *emsg = GNUNET_strdup (strerror (errno)); return 0; } return ret; -- 2.25.1