From a060d87754a3395da19a4e567595f518b0ec7cd3 Mon Sep 17 00:00:00 2001 From: Filip Navara Date: Mon, 8 Dec 2003 19:17:56 +0000 Subject: [PATCH] Fix for buggy libc under Linux. Patch by Sebastian Schmidt . svn path=/trunk/; revision=6919 --- reactos/tools/rcopy.c | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/reactos/tools/rcopy.c b/reactos/tools/rcopy.c index e1d504aab80..343c7f377b8 100644 --- a/reactos/tools/rcopy.c +++ b/reactos/tools/rcopy.c @@ -170,8 +170,32 @@ copy_directory (char *path1, char *path2) } #else - /* Linux version */ + +static int +is_reg (char *path, char *fn) +{ + char buf[MAX_PATH]; + char buf2[MAX_PATH]; + struct stat sbuf; + + strcpy(buf, path); + if (buf[strlen(buf)-1] != '/') + strcat(buf, "/"); + strcat(buf, fn); + + make_absolute(buf2, buf); + + if (stat(buf2, &sbuf) == -1) + return 0; + else { + if (S_ISREG(sbuf.st_mode)) + return 1; + else + return 0; + } +} + static void copy_directory (char *path1, char *path2) { @@ -191,7 +215,7 @@ copy_directory (char *path1, char *path2) if (strcmp(entry->d_name, ".") == 0 || strcmp(entry->d_name, "..") == 0) continue; // skip self and parent - if (entry->d_type == DT_REG) // normal file + if (entry->d_type == DT_REG || is_reg(path1, entry->d_name)) // normal file { // Convert to absolute path make_absolute(buf, path1);