Kamil Dudka
2018-03-21 14:44:21 UTC
... because there is no such module in gnulib
---
lib/fts.c | 26 +++++---------------------
1 file changed, 5 insertions(+), 21 deletions(-)
diff --git a/lib/fts.c b/lib/fts.c
index bfa73e31e..4195f6170 100644
--- a/lib/fts.c
+++ b/lib/fts.c
@@ -253,7 +253,6 @@ static int fts_safe_changedir (FTS *, FTSENT *, int, const char *)
# include <inttypes.h>
# include <stdint.h>
# include <stdio.h>
-# include "getcwdat.h"
bool fts_debug = false;
# define Dprintf(x) do { if (fts_debug) printf x; } while (false)
#else
@@ -1734,23 +1733,14 @@ fd_ring_print (FTS const *sp, FILE *stream, char const *msg)
{
I_ring const *fd_ring = &sp->fts_fd_ring;
unsigned int i = fd_ring->fts_front;
- char *cwd = getcwdat (sp->fts_cwd_fd, NULL, 0);
- fprintf (stream, "=== %s ========== %s\n", msg, cwd);
- free (cwd);
+ fprintf (stream, "=== %s ========== %d\n", msg, sp->fts_cwd_fd);
if (i_ring_empty (fd_ring))
return;
while (true)
{
int fd = fd_ring->fts_fd_ring[i];
- if (fd < 0)
- fprintf (stream, "%d: %d:\n", i, fd);
- else
- {
- char *wd = getcwdat (fd, NULL, 0);
- fprintf (stream, "%d: %d: %s\n", i, fd, wd);
- free (wd);
- }
+ fprintf (stream, "%d: %d:\n", i, fd);
if (i == fd_ring->fts_back)
break;
i = (i + I_RING_SIZE - 1) % I_RING_SIZE;
@@ -1770,9 +1760,7 @@ fd_ring_check (FTS const *sp)
int cwd_fd = sp->fts_cwd_fd;
cwd_fd = fcntl (cwd_fd, F_DUPFD_CLOEXEC, STDERR_FILENO + 1);
- char *dot = getcwdat (cwd_fd, NULL, 0);
- error (0, 0, "===== check ===== cwd: %s", dot);
- free (dot);
+ error (0, 0, "===== check ===== cwd: %d", cwd_fd);
while ( ! i_ring_empty (&fd_w))
{
int fd = i_ring_pop (&fd_w);
@@ -1787,12 +1775,8 @@ fd_ring_check (FTS const *sp)
}
if (!same_fd (fd, parent_fd))
{
- char *cwd = getcwdat (fd, NULL, 0);
- error (0, errno, "ring : %s", cwd);
- char *c2 = getcwdat (parent_fd, NULL, 0);
- error (0, errno, "parent: %s", c2);
- free (cwd);
- free (c2);
+ error (0, errno, "ring : %d", fd);
+ error (0, errno, "parent: %d", parent_fd);
fts_assert (0);
}
close (cwd_fd);
---
lib/fts.c | 26 +++++---------------------
1 file changed, 5 insertions(+), 21 deletions(-)
diff --git a/lib/fts.c b/lib/fts.c
index bfa73e31e..4195f6170 100644
--- a/lib/fts.c
+++ b/lib/fts.c
@@ -253,7 +253,6 @@ static int fts_safe_changedir (FTS *, FTSENT *, int, const char *)
# include <inttypes.h>
# include <stdint.h>
# include <stdio.h>
-# include "getcwdat.h"
bool fts_debug = false;
# define Dprintf(x) do { if (fts_debug) printf x; } while (false)
#else
@@ -1734,23 +1733,14 @@ fd_ring_print (FTS const *sp, FILE *stream, char const *msg)
{
I_ring const *fd_ring = &sp->fts_fd_ring;
unsigned int i = fd_ring->fts_front;
- char *cwd = getcwdat (sp->fts_cwd_fd, NULL, 0);
- fprintf (stream, "=== %s ========== %s\n", msg, cwd);
- free (cwd);
+ fprintf (stream, "=== %s ========== %d\n", msg, sp->fts_cwd_fd);
if (i_ring_empty (fd_ring))
return;
while (true)
{
int fd = fd_ring->fts_fd_ring[i];
- if (fd < 0)
- fprintf (stream, "%d: %d:\n", i, fd);
- else
- {
- char *wd = getcwdat (fd, NULL, 0);
- fprintf (stream, "%d: %d: %s\n", i, fd, wd);
- free (wd);
- }
+ fprintf (stream, "%d: %d:\n", i, fd);
if (i == fd_ring->fts_back)
break;
i = (i + I_RING_SIZE - 1) % I_RING_SIZE;
@@ -1770,9 +1760,7 @@ fd_ring_check (FTS const *sp)
int cwd_fd = sp->fts_cwd_fd;
cwd_fd = fcntl (cwd_fd, F_DUPFD_CLOEXEC, STDERR_FILENO + 1);
- char *dot = getcwdat (cwd_fd, NULL, 0);
- error (0, 0, "===== check ===== cwd: %s", dot);
- free (dot);
+ error (0, 0, "===== check ===== cwd: %d", cwd_fd);
while ( ! i_ring_empty (&fd_w))
{
int fd = i_ring_pop (&fd_w);
@@ -1787,12 +1775,8 @@ fd_ring_check (FTS const *sp)
}
if (!same_fd (fd, parent_fd))
{
- char *cwd = getcwdat (fd, NULL, 0);
- error (0, errno, "ring : %s", cwd);
- char *c2 = getcwdat (parent_fd, NULL, 0);
- error (0, errno, "parent: %s", c2);
- free (cwd);
- free (c2);
+ error (0, errno, "ring : %d", fd);
+ error (0, errno, "parent: %d", parent_fd);
fts_assert (0);
}
close (cwd_fd);
--
2.14.3
2.14.3