summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2006-09-03 02:53:37 +0000
committerPaul Eggert <eggert@cs.ucla.edu>2006-09-03 02:53:37 +0000
commit963d29f916e79e58afca07707762eadd187a7929 (patch)
treea047b71b82bed66f2274d7b193ddcc1fdc6cbe8e /src
parentd8049d74780e587525622f69219243097a13861b (diff)
downloadcoreutils-963d29f916e79e58afca07707762eadd187a7929.tar.xz
Include "dirname.h", since dot_or_dotdot needs it
now. (dot_or_dotdot): Succeed even if "." or ".." is followed by a slash.
Diffstat (limited to 'src')
-rw-r--r--src/system.h14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/system.h b/src/system.h
index 577692cfd..56636c735 100644
--- a/src/system.h
+++ b/src/system.h
@@ -368,17 +368,21 @@ uid_t getuid ();
#define X2REALLOC(P, PN) ((void) verify_true (sizeof *(P) == 1), \
x2realloc (P, PN))
-/* Include automatically-generated macros for unlocked I/O. */
#include "unlocked-io.h"
#include "same-inode.h"
+#include "dirname.h"
+
static inline bool
dot_or_dotdot (char const *file_name)
{
- return (file_name[0] == '.'
- && (file_name[1] == '\0'
- || (file_name[1] == '.'
- && file_name[2] == '\0')));
+ if (file_name[0] == '.')
+ {
+ char sep = file_name[(file_name[1] == '.') + 1];
+ return (! sep || ISSLASH (sep));
+ }
+ else
+ return false;
}
/* A wrapper for readdir so that callers don't see entries for `.' or `..'. */