From: Andre Noll Date: Sun, 25 Sep 2022 20:58:21 +0000 (+0200) Subject: fd: Remove log message from para_munmap(). X-Git-Tag: v0.7.3~13^2~4 X-Git-Url: http://git.tue.mpg.de/?a=commitdiff_plain;h=9190cb37a393b6f245a2bc17f9aeb9eb02a8e629;p=paraslash.git 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. --- 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); } /**