[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: fts: expose dirent.d_type data when possible
From: |
Jim Meyering |
Subject: |
Re: fts: expose dirent.d_type data when possible |
Date: |
Mon, 08 Dec 2008 21:18:13 +0100 |
Simon Josefsson <address@hidden> wrote:
> Jim Meyering <address@hidden> writes:
>
>> + case DT_LNK:
>> + type = S_IFLNK;
>> + break;
> ...
>> + case DT_SOCK:
>> + type = S_IFSOCK;
>> + break;
>
> This patch causes mingw failures:
>
> fts.c: In function 'set_stat_type':
> fts.c:1035: error: 'S_IFLNK' undeclared (first use in this function)
> fts.c:1035: error: (Each undeclared identifier is reported only once
> fts.c:1035: error: for each function it appears in.)
> fts.c:1041: error: 'S_IFSOCK' undeclared (first use in this function)
>
> Given that S_IFLNK and S_IFSOCK are POSIX constants, possibly sys/stat.h
> should define them. But is it possible to do this in any useful way?
> Which values should be used?
Hi Simon,
Thanks for the report.
How about this?
>From 02839ac83976673586c012f91932b10d106bd727 Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Mon, 8 Dec 2008 21:14:41 +0100
Subject: [PATCH] work around mingw's lack of some S_IF definitions
* lib/fts.c: Include <limits.h>.
(S_IFLNK, S_IFSOCK): Define if not already defined.
Reported by Simon Josefsson.
---
ChangeLog | 6 ++++++
lib/fts.c | 7 +++++++
2 files changed, 13 insertions(+), 0 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index f6ed815..d41f43a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2008-12-08 Jim Meyering <address@hidden>
+
+ work around mingw's lack of some S_IF definitions
+ * lib/fts.c (S_IFLNK, S_IFSOCK): Define if not already defined.
+ Reported by Simon Josefsson.
+
2008-12-06 Bruno Haible <address@hidden>
* lib/c-stack.h (c_stack_action): Clarify possible side effects.
diff --git a/lib/fts.c b/lib/fts.c
index 4689e80..836c179 100644
--- a/lib/fts.c
+++ b/lib/fts.c
@@ -111,6 +111,13 @@ static char sccsid[] = "@(#)fts.c 8.6 (Berkeley) 8/14/94";
# define DT_SOCK 7
#endif
+#ifndef S_IFLNK
+# define S_IFLNK 0
+#endif
+#ifndef S_IFSOCK
+# define S_IFSOCK 0
+#endif
+
enum
{
NOT_AN_INODE_NUMBER = 0
--
1.6.0.4.1101.g642f8