bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Eliminate one way canonicalize_filename_mode could exit.


From: Jim Meyering
Subject: Eliminate one way canonicalize_filename_mode could exit.
Date: Mon, 18 Jun 2007 14:29:12 +0200

This proposed change removes the sole use of xreadlink_with_size:

        Eliminate one way canonicalize_filename_mode could exit.
        * lib/canonicalize.c (canonicalize_filename_mode):
        Use mreadlink_with_size, not xreadlink_with_size.

The only behavior change here is that now, canonicalize_filename_mode
returns NULL/ENOMEM upon OOM or upon encountering a ridiculously
(impossibly?) long symlink name.  Before, it could return NULL for
other reasons, so all callers already had to deal with that case.

I'd say it's not even worth documenting this in NEWS.

Index: lib/canonicalize.c
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/canonicalize.c,v
retrieving revision 1.10
diff -u -p -r1.10 canonicalize.c
--- lib/canonicalize.c  1 Mar 2007 00:39:40 -0000       1.10
+++ lib/canonicalize.c  18 Jun 2007 12:21:54 -0000
@@ -47,7 +47,7 @@
 #endif

 #include "pathmax.h"
-#include "xreadlink.h"
+#include "mreadlink.h"

 #if !HAVE_CANONICALIZE_FILE_NAME
 /* Return the canonical absolute name of file NAME.  A canonical name
@@ -246,10 +246,10 @@ canonicalize_filename_mode (const char *
                    goto error;
                }

-             buf = xreadlink_with_size (rname, st.st_size);
+             buf = mreadlink_with_size (rname, st.st_size);
              if (!buf)
                {
-                 if (can_mode == CAN_MISSING)
+                 if (can_mode == CAN_MISSING && errno != ENOMEM)
                    continue;
                  else
                    goto error;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]