summaryrefslogtreecommitdiff
path: root/syscall.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>1998-05-06 07:00:38 +0000
committerAndrew Tridgell <tridge@samba.org>1998-05-06 07:00:38 +0000
commitd6e6ecbdbf0452ec95afc98c2700076e39b4692f (patch)
tree77d3d8c5ec675abd254abf247b1ab6765fda074c /syscall.c
parent73233f0f1232c337ede5fae3f9f95d78457df7d0 (diff)
downloadrsync-d6e6ecbdbf0452ec95afc98c2700076e39b4692f.tar.gz
handle broken readdir() on Solaris 2.6 (it returns the name offset by
2 characters!)
Diffstat (limited to 'syscall.c')
-rw-r--r--syscall.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/syscall.c b/syscall.c
index a004d9d3..5bf3e476 100644
--- a/syscall.c
+++ b/syscall.c
@@ -133,3 +133,21 @@ OFF_T do_lseek(int fd, OFF_T offset, int whence)
return lseek(fd, offset, whence);
#endif
}
+
+char *d_name(struct dirent *di)
+{
+#if defined(SunOS) && SunOS >= 50
+ static int first = 1;
+ static int broken;
+ if (first) {
+ first = 0;
+ if (!di->d_name[0] && strcmp(".", di->d_name-2)==0) {
+ fprintf(stderr,"WARNING: broken readdir\n");
+ broken = 1;
+ }
+ }
+ if (broken)
+ return (di->d_name - 2);
+#endif
+ return di->d_name;
+}