]> git.tuebingen.mpg.de Git - paraslash.git/commitdiff
fd: Remove log message from para_munmap().
authorAndre Noll <maan@tuebingen.mpg.de>
Sun, 25 Sep 2022 20:58:21 +0000 (22:58 +0200)
committerAndre Noll <maan@tuebingen.mpg.de>
Sun, 7 May 2023 18:45:22 +0000 (20:45 +0200)
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

diff --git a/fd.c b/fd.c
index cc38f1afba150e0de41fff093c0c5b7ccb24e377..236494515697ba18d01ad3e5049839d7780be6ad 100644 (file)
--- 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);
 }
 
 /**