From 9190cb37a393b6f245a2bc17f9aeb9eb02a8e629 Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Sun, 25 Sep 2022 22:58:21 +0200 Subject: [PATCH] fd: Remove log message from para_munmap(). Low-level functions like this should leave it to the caller to log the error. Extend the documentation a bit while at it to document the fact that passing NULL is OK. --- fd.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/fd.c b/fd.c index cc38f1af..23649451 100644 --- a/fd.c +++ b/fd.c @@ -530,22 +530,21 @@ out: * \param start The start address of the memory mapping. * \param length The size of the mapping. * - * \return Standard. + * If NULL is passed as the start address, the length value is ignored and the + * function does nothing. + * + * \return Zero if NULL was passed, one if the memory area was successfully + * unmapped, a negative error code otherwise. * * \sa munmap(2), \ref mmap_full_file(). */ int para_munmap(void *start, size_t length) { - int err; - if (!start) return 0; if (munmap(start, length) >= 0) return 1; - err = errno; - PARA_ERROR_LOG("munmap (%p/%zu) failed: %s\n", start, length, - strerror(err)); - return -ERRNO_TO_PARA_ERROR(err); + return -ERRNO_TO_PARA_ERROR(errno); } /** -- 2.39.5