From: Paul Eggert Date: Sun, 3 Sep 2006 02:53:37 +0000 (+0000) Subject: Include "dirname.h", since dot_or_dotdot needs it X-Git-Tag: COREUTILS-6_2~46 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=963d29f916e79e58afca07707762eadd187a7929;p=platform%2Fupstream%2Fcoreutils.git Include "dirname.h", since dot_or_dotdot needs it now. (dot_or_dotdot): Succeed even if "." or ".." is followed by a slash. --- diff --git a/src/system.h b/src/system.h index 577692c..56636c7 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 `..'. */