bug-gnulib@gnu.org mirror (unofficial)
 help / color / mirror / Atom feed
From: Bruno Haible <bruno@clisp.org>
To: bug-gnulib@gnu.org
Subject: Re: filenamecat-lgpl: set errno upon failure
Date: Sat, 27 Jun 2020 02:46:48 +0200	[thread overview]
Message-ID: <2759981.s5oSo37oWp@omega> (raw)
In-Reply-To: <1789667.hs3xuZjgW9@omega>

Based on this patch, _gl_register_fd is now guaranteed to set errno upon
failure.


2020-06-26  Bruno Haible  <bruno@clisp.org>

	fchdir: Improve documentation.
	* lib/fchdir.c (get_name, _gl_register_fd): Document the failure return
	convention.

diff --git a/lib/fchdir.c b/lib/fchdir.c
index 20ecd3c..1fa9a7e 100644
--- a/lib/fchdir.c
+++ b/lib/fchdir.c
@@ -84,7 +84,8 @@ ensure_dirs_slot (size_t fd)
   return true;
 }
 
-/* Return an absolute name of DIR in malloc'd storage.  */
+/* Return an absolute name of DIR in malloc'd storage.
+   Upon failure, return NULL with errno set.  */
 static char *
 get_name (char const *dir)
 {
@@ -125,8 +126,8 @@ _gl_unregister_fd (int fd)
 /* Mark FD as visiting FILENAME.  FD must be non-negative, and refer
    to an open file descriptor.  If REPLACE_OPEN_DIRECTORY is non-zero,
    this should only be called if FD is visiting a directory.  Close FD
-   and return -1 if there is insufficient memory to track the
-   directory name; otherwise return FD.  */
+   and return -1 with errno set if there is insufficient memory to track
+   the directory name; otherwise return FD.  */
 int
 _gl_register_fd (int fd, const char *filename)
 {



      reply	other threads:[~2020-06-27  0:46 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-27  0:41 filenamecat-lgpl: set errno upon failure Bruno Haible
2020-06-27  0:46 ` Bruno Haible [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://lists.gnu.org/mailman/listinfo/bug-gnulib

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2759981.s5oSo37oWp@omega \
    --to=bruno@clisp.org \
    --cc=bug-gnulib@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).